Update static/index.html
Browse files- static/index.html +26 -13
static/index.html
CHANGED
|
@@ -274,19 +274,32 @@
|
|
| 274 |
}
|
| 275 |
|
| 276 |
function generatePrompts() {
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
|
| 291 |
function sendInputs() {
|
| 292 |
const inputs = document.getElementById("inputs").value;
|
|
|
|
| 274 |
}
|
| 275 |
|
| 276 |
function generatePrompts() {
|
| 277 |
+
// Show spinner inside the inputs element
|
| 278 |
+
document.getElementById('inputs').innerHTML = '<div class="spinner"></div>';
|
| 279 |
+
|
| 280 |
+
// Get the prompt text from the input field
|
| 281 |
+
const prompt = document.getElementById("prompt").value;
|
| 282 |
+
|
| 283 |
+
// Show spinner
|
| 284 |
+
showSpinner('promptSpinner');
|
| 285 |
+
|
| 286 |
+
// Perform fetch request to generate prompts
|
| 287 |
+
fetch(`/generate_prompts?prompt_text=${encodeURIComponent(prompt)}`)
|
| 288 |
+
.then(response => response.text())
|
| 289 |
+
.then(data => {
|
| 290 |
+
// Update the input field with generated prompts
|
| 291 |
+
document.getElementById("inputs").value = data.trim();
|
| 292 |
+
// Hide spinner
|
| 293 |
+
hideSpinner('promptSpinner');
|
| 294 |
+
})
|
| 295 |
+
.catch(error => {
|
| 296 |
+
// Log any errors
|
| 297 |
+
console.error('Error:', error);
|
| 298 |
+
// Hide spinner
|
| 299 |
+
hideSpinner('promptSpinner');
|
| 300 |
+
});
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
|
| 304 |
function sendInputs() {
|
| 305 |
const inputs = document.getElementById("inputs").value;
|