creamy-barista-48262
03/24/2024, 3:18 PMcreamy-barista-48262
03/24/2024, 3:19 PMcreamy-barista-48262
03/24/2024, 3:20 PMglamorous-guitar-39983
03/24/2024, 6:17 PMglamorous-guitar-39983
03/24/2024, 6:19 PMwide-oyster-38514
03/24/2024, 6:20 PMcreamy-barista-48262
03/24/2024, 6:25 PMapi-error: ${error.message}
)
}
throw new Error(api-error: ${error}
)
}creamy-barista-48262
03/24/2024, 6:27 PMapi-error: ${error.message}
)
}
throw new Error(api-error: ${error}
)
}creamy-barista-48262
03/24/2024, 6:28 PMglamorous-guitar-39983
03/24/2024, 6:29 PMcreamy-barista-48262
03/24/2024, 6:30 PMcreamy-barista-48262
03/24/2024, 6:30 PMglamorous-guitar-39983
03/24/2024, 6:30 PMcreamy-barista-48262
03/24/2024, 6:31 PMglamorous-guitar-39983
03/24/2024, 6:31 PMcreamy-barista-48262
03/24/2024, 6:32 PMcreamy-barista-48262
03/24/2024, 6:32 PMglamorous-guitar-39983
03/24/2024, 6:32 PMglamorous-guitar-39983
03/24/2024, 6:33 PMcreamy-barista-48262
03/24/2024, 6:34 PMconst inputMessage = workflow.question;
const API_URL = "https://www.stack-inference.com/inference/v0/run/b070374c-a524-4d9c-91fe-4e61a4261965/660038b292cd58e24160e26b";
const headers = {
'Authorization': 'Bearer e63b9f84-6989-43a3-9c26-d7ebfe51725a', 'Content-Type': 'application/json'
};
const payload = {
"in-0": inputMessage
};
try {
const response = await axios.post(API_URL, payload, { headers: headers });
workflow.stackAiResponse = response.data["out-0"];
} catch (error) {
throw new Error(`Error in Stack AI: ${error}`)
}
fresh-fireman-491
03/24/2024, 6:38 PMfresh-fireman-491
03/24/2024, 6:38 PMcreamy-barista-48262
03/24/2024, 6:39 PMglamorous-guitar-39983
03/24/2024, 6:39 PMcreamy-barista-48262
03/24/2024, 6:44 PMglamorous-guitar-39983
03/24/2024, 6:45 PMglamorous-guitar-39983
03/24/2024, 6:46 PMcreamy-barista-48262
03/24/2024, 6:47 PMfunction uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
workflow.acheterPlus = "J'attendrai jusqu'à demain !"
workflow.conversationID = uuidv4();
console.log(workflow.conversationID);
// Collez votre url javacript Stack AI
const endpoint = "https://www.stack-inference.com/inference/v0/run/b070374c-a524-4d9c-91fe-4e61a4261965/660038b292cd58e24160e26b"
workflow.nombreDeMessages += 1
console.log(workflow.nombreDeMessages)
// Collez votre API PUBLIC KEY
const headers = {
Authorization: 'Bearer e63b9f84-6989-43a3-9c26-d7ebfe51725a',
'Content-Type': 'application/json'
}
function extractInitialMessage(sessionConversation) {
for (const conversation of sessionConversation) {
if (conversation['sender'] === 'user') {
workflow.question = conversation['preview']
}
}
}
extractInitialMessage(event.state.session.history)
const data = {
'in-0': workflow.question,
'user_id': workflow.conversationID
}
try {
const response = await axios.post(endpoint, data, { headers })
if (response.status === 200) {
workflow.messageSuivant = response.data['out-0']
}
} catch (error) {
if (error instanceof Error) {
throw new Error(`api-error: ${error.message}`)
}
throw new Error(`api-error: ${error}`)
}
creamy-barista-48262
03/24/2024, 6:52 PMcreamy-barista-48262
03/24/2024, 6:53 PMglamorous-guitar-39983
03/24/2024, 6:53 PMglamorous-guitar-39983
03/24/2024, 6:53 PMcreamy-barista-48262
03/24/2024, 6:53 PMglamorous-guitar-39983
03/24/2024, 6:56 PMglamorous-guitar-39983
03/24/2024, 6:56 PMcreamy-barista-48262
03/24/2024, 6:56 PMfunction uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
workflow.acheterPlus = "J'attendrai jusqu'à demain !"
workflow.conversationID = uuidv4();
console.log(workflow.conversationID);
// Collez votre url javacript Stack AI
const endpoint = "https://www.stack-inference.com/inference/v0/run/b070374c-a524-4d9c-91fe-4e61a4261965/660038b292cd58e24160e26b"
workflow.nombreDeMessages += 1
console.log(workflow.nombreDeMessages)
// Collez votre API PUBLIC KEY
const headers = {
Authorization: 'Bearer e63b9f84-6989-43a3-9c26-d7ebfe51725a',
'Content-Type': 'application/json'
}
function extractInitialMessage(sessionConversation) {
for (const conversation of sessionConversation) {
if (conversation['sender'] === 'user') {
workflow.question = conversation['preview']
}
}
}
extractInitialMessage(event.state.session.history)
const data = {
'in-0': workflow.question,
'user_id': workflow.conversationID
}
try {
const response = await axios.post(endpoint, data, { headers })
if (response.status === 200) {
workflow.messageSuivant = response.data['out-0']
}
} catch (error) {
if (error instanceof Error) {
throw new Error(`api-error: ${error.message}`)
}
throw new Error(`api-error: ${error}`)
}
creamy-barista-48262
03/24/2024, 6:57 PMglamorous-guitar-39983
03/24/2024, 6:59 PM