Futuresony commited on
Commit
6f055e9
·
verified ·
1 Parent(s): e853286

Update static/script.js

Browse files
Files changed (1) hide show
  1. 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);