Spaces:
Sleeping
Sleeping
Update frontend/assets/script.js
#2
by
Ay-ouya
- opened
- frontend/assets/script.js +15 -14
frontend/assets/script.js
CHANGED
|
@@ -158,20 +158,21 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 158 |
const formData = new FormData();
|
| 159 |
formData.append('file', attachedFile);
|
| 160 |
|
| 161 |
-
if (fileType
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
|
|
|
| 175 |
|
| 176 |
} else if (images.includes(fileType)) {
|
| 177 |
if (text.toLowerCase().includes('interpretation')) {
|
|
|
|
| 158 |
const formData = new FormData();
|
| 159 |
formData.append('file', attachedFile);
|
| 160 |
|
| 161 |
+
if (fileType === 'xlsx' && text.toLowerCase().includes('generate code of')) {
|
| 162 |
+
endpoint = '/generate-visualization';
|
| 163 |
+
task = 'visualization';
|
| 164 |
+
const codeRequest = text.toLowerCase().split('generate code of')[1]?.trim();
|
| 165 |
+
if (!codeRequest) {
|
| 166 |
+
tempMessage.remove();
|
| 167 |
+
currentConversation.pop();
|
| 168 |
+
errorMSG = 'Please specify what visualization code to generate (e.g., "generate code of a bar chart").';
|
| 169 |
+
displayMessage(errorMSG, 'agent');
|
| 170 |
+
currentConversation.push({ text: `${errorMSG}`, sender: 'agent' });
|
| 171 |
+
isAgentThinking = false;
|
| 172 |
+
enable_disableSendButton();
|
| 173 |
+
return;
|
| 174 |
+
}
|
| 175 |
+
formData.append('request', codeRequest);
|
| 176 |
|
| 177 |
} else if (images.includes(fileType)) {
|
| 178 |
if (text.toLowerCase().includes('interpretation')) {
|