Update templates/index.html
Browse files- templates/index.html +26 -26
templates/index.html
CHANGED
|
@@ -1,40 +1,40 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html>
|
| 3 |
<head>
|
| 4 |
-
<
|
|
|
|
| 5 |
<style>
|
| 6 |
-
body { font-family: '
|
| 7 |
-
#
|
| 8 |
-
.thought { color: #888; font-style: italic; background: #
|
| 9 |
-
.
|
| 10 |
-
input { width:
|
| 11 |
-
button { padding: 12px
|
| 12 |
</style>
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
-
<h2>
|
| 16 |
-
<div id="
|
| 17 |
-
<
|
| 18 |
-
<
|
| 19 |
-
<button onclick="sendMsg()">Send</button>
|
| 20 |
|
| 21 |
<script>
|
| 22 |
-
async function
|
| 23 |
const input = document.getElementById('user-input');
|
| 24 |
-
const
|
| 25 |
-
const
|
| 26 |
-
if(!
|
| 27 |
|
| 28 |
-
|
| 29 |
input.value = '';
|
| 30 |
|
| 31 |
const resDiv = document.createElement('div');
|
| 32 |
-
|
| 33 |
|
| 34 |
const response = await fetch('/chat', {
|
| 35 |
method: 'POST',
|
| 36 |
headers: {'Content-Type': 'application/json'},
|
| 37 |
-
body: JSON.stringify({ message:
|
| 38 |
});
|
| 39 |
|
| 40 |
const reader = response.body.getReader();
|
|
@@ -47,13 +47,13 @@
|
|
| 47 |
|
| 48 |
fullText += decoder.decode(value);
|
| 49 |
|
| 50 |
-
// Real-time parsing of
|
| 51 |
-
let
|
| 52 |
-
.replace(/<thought>([\s\S]*?)<\/thought>/g, '<span class="thought">
|
| 53 |
-
.replace(/<\/thought>([\s\S]*)/g, '</span><span class="
|
| 54 |
|
| 55 |
-
resDiv.innerHTML =
|
| 56 |
-
|
| 57 |
}
|
| 58 |
}
|
| 59 |
</script>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>Enterprise Agent Console</title>
|
| 6 |
<style>
|
| 7 |
+
body { font-family: 'Courier New', monospace; background: #0a0a0a; color: #00ff41; padding: 20px; }
|
| 8 |
+
#console { border: 1px solid #333; height: 500px; overflow-y: auto; padding: 15px; background: #000; margin-bottom: 20px; border-radius: 4px; }
|
| 9 |
+
.thought { color: #888; font-style: italic; background: #111; padding: 10px; border-left: 2px solid #444; margin: 10px 0; display: block; }
|
| 10 |
+
.answer { color: #fff; font-weight: bold; display: block; margin-top: 10px; }
|
| 11 |
+
input { width: 80%; padding: 12px; background: #1a1a1a; color: #fff; border: 1px solid #333; border-radius: 4px; }
|
| 12 |
+
button { padding: 12px 24px; background: #007acc; border: none; color: white; cursor: pointer; border-radius: 4px; }
|
| 13 |
</style>
|
| 14 |
</head>
|
| 15 |
<body>
|
| 16 |
+
<h2>ReAct Agentic Trace</h2>
|
| 17 |
+
<div id="console"></div>
|
| 18 |
+
<input type="text" id="user-input" placeholder="Enter business objective...">
|
| 19 |
+
<button onclick="send()">Execute</button>
|
|
|
|
| 20 |
|
| 21 |
<script>
|
| 22 |
+
async function send() {
|
| 23 |
const input = document.getElementById('user-input');
|
| 24 |
+
const consoleBox = document.getElementById('console');
|
| 25 |
+
const text = input.value;
|
| 26 |
+
if (!text) return;
|
| 27 |
|
| 28 |
+
consoleBox.innerHTML += `<div>> USER: ${text}</div>`;
|
| 29 |
input.value = '';
|
| 30 |
|
| 31 |
const resDiv = document.createElement('div');
|
| 32 |
+
consoleBox.appendChild(resDiv);
|
| 33 |
|
| 34 |
const response = await fetch('/chat', {
|
| 35 |
method: 'POST',
|
| 36 |
headers: {'Content-Type': 'application/json'},
|
| 37 |
+
body: JSON.stringify({ message: text })
|
| 38 |
});
|
| 39 |
|
| 40 |
const reader = response.body.getReader();
|
|
|
|
| 47 |
|
| 48 |
fullText += decoder.decode(value);
|
| 49 |
|
| 50 |
+
// Real-time parsing of the ReAct loop [35, 36]
|
| 51 |
+
let html = fullText
|
| 52 |
+
.replace(/<thought>([\s\S]*?)<\/thought>/g, '<span class="thought">THOUGHT: $1</span>')
|
| 53 |
+
.replace(/<\/thought>([\s\S]*)/g, '</span><span class="answer">FINAL ANSWER: $1</span>');
|
| 54 |
|
| 55 |
+
resDiv.innerHTML = html;
|
| 56 |
+
consoleBox.scrollTop = consoleBox.scrollHeight;
|
| 57 |
}
|
| 58 |
}
|
| 59 |
</script>
|