13 lines
542 B
JavaScript
13 lines
542 B
JavaScript
async function sendMessage() {
|
|
const project = document.getElementById('project').value;
|
|
const message = document.getElementById('message').value;
|
|
const res = await fetch('http://localhost:5000/chat', {
|
|
method: 'POST',
|
|
headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({project, message})
|
|
});
|
|
const data = await res.json();
|
|
const messagesDiv = document.getElementById('messages');
|
|
messagesDiv.innerHTML += `<p><b>Du:</b> ${message}</p><p><b>LLM:</b> ${data.reply}</p>`;
|
|
}
|