From 2aa9aae282c82a7b5d3a184435f5cda3dd7e0343 Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Wed, 17 Jul 2024 23:47:38 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=B6pte=20om=20message=20till=20query=20f?= =?UTF-8?q?=C3=B6r=20b=C3=A4ttre=20semantisk=20=C3=B6verensst=C3=A4mmelse?= =?UTF-8?q?=20med=20vad=20variabeln=20g=C3=B6r.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smartassist/src/frontend.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/smartassist/src/frontend.js b/smartassist/src/frontend.js index e337020..fc8d764 100644 --- a/smartassist/src/frontend.js +++ b/smartassist/src/frontend.js @@ -6,15 +6,15 @@ const userInput = document.getElementById('userInput'); // Define a function to send the user's message to the AI function sendMessage() { // Get the user's input message and trim any whitespace - const message = userInput.value.trim(); + const query = userInput.value.trim(); // Check if the message is not empty - if (message !== '') { + if (query !== '') { // Send a POST request to the /api/chat endpoint with the message fetch('http://localhost:5005/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ message }), + body: JSON.stringify({ query }), }) .then(response => response.json()) .then(data => { @@ -22,7 +22,7 @@ function sendMessage() { const aiResponse = data.response; // Render the user's original message in the chatbox - renderMessage(message, 'user-message'); + renderMessage(query, 'user-message'); // Render the AI's response in the chatbox renderMessage(aiResponse, 'ai-response');