Update templates/index.html
Browse files3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041426 unmodified lines4950515253545556573 unmodified lines<meta charset="UTF-8"><title>ReAct Agent Console</title><style>body { font-family: 'Courier New', Courier, monospace; background: #1e1e1e; color: #d4d4d4; padding: 20px; }#chatbox { border: 1px solid #444; height: 500px; overflow-y: auto; padding: 15px; background: #252526; }.message { margin-bottom: 15px; border-left: 3px solid #007acc; padding-left: 10px; white-space: pre-wrap; }.user-label { color: #569cd6; font-weight: bold; }.agent-label { color: #4ec9b0; font-weight: bold; }#input-area { display: flex; margin-top: 20px; }input { flex-grow: 1; background: #333; color: white; border: 1px solid #555; padding: 10px; }button { background: #007acc; color: white; border: none; padding: 10px 20px; cursor: pointer; }</style></head><body><h2>ReAct Agent Trace</h2><div id="chatbox"></div><div id="input-area"><input type="text" id="user-input" placeholder="Ask for the time or a math problem (e.g., 25 * 4)..."><button onclick="send()">Send</button></div><script>async function send() {const box = document.getElementById('chatbox');const input = document.getElementById('user-input');const text = input.value;if (!text) return;box.innerHTML += `<div><span class="user-label">User:</span> ${text}</div>`;input.value = '';const responseDiv = document.createElement('div');responseDiv.className = 'message';responseDiv.innerHTML = '<span class="agent-label">Agent Traces:</span><br>';box.appendChild(responseDiv);const response = await fetch('/chat', {method: 'POST',headers: {'Content-Type': 'application/json'},6 unmodified lineswhile (true) {const { done, value } = await reader.read();if (done) break;const chunk = decoder.decode(value, { stream: true });responseDiv.innerHTML += chunk;box.scrollTop = box.scrollHeight;}}</script>3 unmodified lines45678910111213141516171819202122232425262728293031323334353637386 unmodified lines45464748495051523 unmodified lines<meta charset="UTF-8"><title>ReAct Agent Console</title><style>body { font-family: monospace; background: #121212; color: #e0e0e0; padding: 20px; }#console { border: 1px solid #333; height: 500px; overflow-y: auto; padding: 15px; margin-bottom: 20px; background: #000; }.trace { border-left: 2px solid #007acc; padding-left: 10px; margin: 10px 0; white-space: pre-wrap; }.user { color: #569cd6; font-weight: bold; }input { width: 80%; padding: 10px; background: #222; color: #fff; border: 1px solid #444; }button { padding: 10px 20px; background: #007acc; border: none; color: white; cursor: pointer; }</style></head><body><h2>ReAct Reasoning Trace</h2><div id="console"></div><input type="text" id="user-input" placeholder="Ask 'whats the time now'..."><button onclick="send()">Execute</button><script>async function send() {const input = document.getElementById('user-input');const consoleBox = document.getElementById('console');const text = input.value;if (!text) return;consoleBox.innerHTML += `<div><span class="user">User:</span> ${text}</div>`;input.value = '';const traceDiv = document.createElement('div');traceDiv.className = 'trace';consoleBox.appendChild(traceDiv);// Fetching a streaming response [23, 24]const response = await fetch('/chat', {method: 'POST',headers: {'Content-Type': 'application/json'},6 unmodified lineswhile (true) {const { done, value } = await reader.read();if (done) break;traceDiv.innerText += decoder.decode(value);consoleBox.scrollTop = consoleBox.scrollHeight;}}</script>
templates/index.html+18-23