in llm_demo/static/index.js [92:107]
async function askQuestion(prompt) {
const response = await fetch('chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ prompt }),
});
if (response.ok) {
const text_response = await response.text();
return JSON.parse(text_response)
} else {
console.error(await response.text())
return { type: "message", content: "Sorry, we couldn't answer your question 😢" }
}
}