Spaces:
Sleeping
Sleeping
Create script.js
Browse files
script.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
async function triggerReflex() {
|
| 2 |
+
const input = document.getElementById("scenarioInput").value;
|
| 3 |
+
const logWindow = document.getElementById("logWindow");
|
| 4 |
+
|
| 5 |
+
if (!input) {
|
| 6 |
+
logWindow.textContent += "\n[Error]: Please enter a scenario description.";
|
| 7 |
+
return;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
const response = await fetch("/run", {
|
| 11 |
+
method: "POST",
|
| 12 |
+
headers: {"Content-Type": "application/json"},
|
| 13 |
+
body: JSON.stringify({ scenario: input })
|
| 14 |
+
});
|
| 15 |
+
|
| 16 |
+
const data = await response.json();
|
| 17 |
+
logWindow.textContent += "\n" + data.logs.join("\n");
|
| 18 |
+
}
|