Spaces:
Running
Running
Futuresony
commited on
Update static/script.js
Browse files- static/script.js +2 -3
static/script.js
CHANGED
@@ -77,7 +77,7 @@ function fetchMessageFromAI(message) {
|
|
77 |
headers: {
|
78 |
'Content-Type': 'application/json',
|
79 |
},
|
80 |
-
body: JSON.stringify({ text: message })
|
81 |
})
|
82 |
.then(response => {
|
83 |
if (!response.ok) {
|
@@ -89,6 +89,7 @@ function fetchMessageFromAI(message) {
|
|
89 |
typingIndicator.style.display = 'none';
|
90 |
|
91 |
if (data.response) {
|
|
|
92 |
addAIResponse(data.response, message);
|
93 |
} else {
|
94 |
console.error("No response from the server.");
|
@@ -147,6 +148,4 @@ function renderAIResponse(responseText, responseId, userPrompt) {
|
|
147 |
chatbox.scrollTop = chatbox.scrollHeight;
|
148 |
}
|
149 |
|
150 |
-
// Other functions (regenerateResponse, displayUpdatedResponse, navigateResponse, etc.) remain unchanged.
|
151 |
-
|
152 |
document.addEventListener('DOMContentLoaded', initSpeechRecognition);
|
|
|
77 |
headers: {
|
78 |
'Content-Type': 'application/json',
|
79 |
},
|
80 |
+
body: JSON.stringify({ text: message }) // Sending message text as JSON
|
81 |
})
|
82 |
.then(response => {
|
83 |
if (!response.ok) {
|
|
|
89 |
typingIndicator.style.display = 'none';
|
90 |
|
91 |
if (data.response) {
|
92 |
+
// Add the AI's response to the chatbox
|
93 |
addAIResponse(data.response, message);
|
94 |
} else {
|
95 |
console.error("No response from the server.");
|
|
|
148 |
chatbox.scrollTop = chatbox.scrollHeight;
|
149 |
}
|
150 |
|
|
|
|
|
151 |
document.addEventListener('DOMContentLoaded', initSpeechRecognition);
|