Extraherar nu svaret från ollama och skickar detta till frontend
This commit is contained in:
@@ -34,31 +34,7 @@ function sendMessage() {
|
||||
}
|
||||
}
|
||||
|
||||
// function sendMessage() {
|
||||
// const message = userInput.value.trim();
|
||||
// if (message !== '') {
|
||||
// // Create a new XMLHttpRequest object
|
||||
// const xhr = new XMLHttpRequest();
|
||||
|
||||
// // Configure the request
|
||||
// xhr.open('POST', 'http://localhost:5000/api/chat'); // Set method to POST and URL
|
||||
// xhr.setRequestHeader('Content-Type', 'application/json'); // Essential for sending JSON
|
||||
|
||||
// // Handle response data
|
||||
// xhr.onload = function() {
|
||||
// if (xhr.status >= 200 && xhr.status < 300) { // Successful response
|
||||
// const data = JSON.parse(xhr.responseText);
|
||||
// renderMessage(data.response, 'ai-response');
|
||||
|
||||
// } else {
|
||||
// console.error('Request failed. Status:', xhr.status);
|
||||
// }
|
||||
// };
|
||||
|
||||
// // Send the request
|
||||
// xhr.send(JSON.stringify({ message }));
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// Define a function to render a message in the chatbox with a specific class name
|
||||
|
||||
Reference in New Issue
Block a user