TheEdict commited on
Commit
b907fbc
·
verified ·
1 Parent(s): 8ab334f

Add missing marimo-zero-ui.html for Docker build

Browse files
Files changed (1) hide show
  1. marimo-zero-ui.html +337 -0
marimo-zero-ui.html ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Marimo Zero - Toggle Sandbox</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
16
+ background: #1a1a2e;
17
+ color: #eee;
18
+ height: 100vh;
19
+ overflow: hidden;
20
+ }
21
+
22
+ .container {
23
+ display: flex;
24
+ height: 100vh;
25
+ }
26
+
27
+ /* Agent Zero Chat Panel */
28
+ .chat-panel {
29
+ flex: 1;
30
+ display: flex;
31
+ flex-direction: column;
32
+ border-right: 1px solid #333;
33
+ transition: all 0.3s ease;
34
+ }
35
+
36
+ .chat-panel.collapsed {
37
+ flex: 0;
38
+ opacity: 0;
39
+ pointer-events: none;
40
+ }
41
+
42
+ .chat-header {
43
+ padding: 1rem;
44
+ background: #16213e;
45
+ border-bottom: 1px solid #333;
46
+ display: flex;
47
+ justify-content: space-between;
48
+ align-items: center;
49
+ }
50
+
51
+ .chat-header h1 {
52
+ font-size: 1.2rem;
53
+ color: #00d9ff;
54
+ }
55
+
56
+ .chat-body {
57
+ flex: 1;
58
+ overflow-y: auto;
59
+ padding: 1rem;
60
+ }
61
+
62
+ .chat-input {
63
+ padding: 1rem;
64
+ background: #16213e;
65
+ border-top: 1px solid #333;
66
+ }
67
+
68
+ .chat-input textarea {
69
+ width: 100%;
70
+ padding: 0.75rem;
71
+ border: 1px solid #333;
72
+ border-radius: 8px;
73
+ background: #0f0f23;
74
+ color: #eee;
75
+ resize: none;
76
+ font-family: inherit;
77
+ }
78
+
79
+ .chat-input button {
80
+ margin-top: 0.5rem;
81
+ padding: 0.5rem 1rem;
82
+ background: #00d9ff;
83
+ color: #000;
84
+ border: none;
85
+ border-radius: 6px;
86
+ cursor: pointer;
87
+ font-weight: 600;
88
+ }
89
+
90
+ .chat-input button:hover {
91
+ background: #00b8d9;
92
+ }
93
+
94
+ /* Marimo Sandbox Panel */
95
+ .marimo-panel {
96
+ width: 50%;
97
+ display: flex;
98
+ flex-direction: column;
99
+ transition: all 0.3s ease;
100
+ }
101
+
102
+ .marimo-panel.hidden {
103
+ width: 0;
104
+ opacity: 0;
105
+ overflow: hidden;
106
+ }
107
+
108
+ .marimo-header {
109
+ padding: 1rem;
110
+ background: #16213e;
111
+ border-bottom: 1px solid #333;
112
+ display: flex;
113
+ justify-content: space-between;
114
+ align-items: center;
115
+ }
116
+
117
+ .marimo-header h2 {
118
+ font-size: 1.2rem;
119
+ color: #ff6b6b;
120
+ }
121
+
122
+ .marimo-frame {
123
+ flex: 1;
124
+ border: none;
125
+ background: #fff;
126
+ }
127
+
128
+ /* Toggle Button */
129
+ .toggle-btn {
130
+ padding: 0.5rem 1rem;
131
+ background: #ff6b6b;
132
+ color: #fff;
133
+ border: none;
134
+ border-radius: 6px;
135
+ cursor: pointer;
136
+ font-weight: 600;
137
+ transition: background 0.2s;
138
+ }
139
+
140
+ .toggle-btn:hover {
141
+ background: #ff5252;
142
+ }
143
+
144
+ .toggle-btn.active {
145
+ background: #4ecdc4;
146
+ }
147
+
148
+ /* Resize Handle */
149
+ .resize-handle {
150
+ width: 4px;
151
+ background: #333;
152
+ cursor: col-resize;
153
+ transition: background 0.2s;
154
+ }
155
+
156
+ .resize-handle:hover {
157
+ background: #00d9ff;
158
+ }
159
+
160
+ /* Message Styles */
161
+ .message {
162
+ margin-bottom: 1rem;
163
+ padding: 0.75rem;
164
+ border-radius: 8px;
165
+ max-width: 80%;
166
+ }
167
+
168
+ .message.user {
169
+ background: #00d9ff;
170
+ color: #000;
171
+ margin-left: auto;
172
+ }
173
+
174
+ .message.assistant {
175
+ background: #2a2a4a;
176
+ color: #eee;
177
+ }
178
+
179
+ .message pre {
180
+ background: #0f0f23;
181
+ padding: 0.5rem;
182
+ border-radius: 4px;
183
+ overflow-x: auto;
184
+ margin-top: 0.5rem;
185
+ }
186
+
187
+ .message code {
188
+ font-family: 'Consolas', 'Monaco', monospace;
189
+ font-size: 0.9rem;
190
+ }
191
+ </style>
192
+ </head>
193
+ <body>
194
+ <div class="container">
195
+ <!-- Agent Zero Chat Panel -->
196
+ <div class="chat-panel" id="chatPanel">
197
+ <div class="chat-header">
198
+ <h1>🤖 Agent Zero</h1>
199
+ <button class="toggle-btn" id="toggleChatBtn" onclick="toggleChat()">Hide Chat</button>
200
+ </div>
201
+ <div class="chat-body" id="chatBody">
202
+ <div class="message assistant">
203
+ <strong>Agent Zero:</strong>
204
+ <p>Welcome to Marimo Zero! I'm your AI assistant. Use the toggle button to show/hide the Marimo sandbox for code execution.</p>
205
+ </div>
206
+ </div>
207
+ <div class="chat-input">
208
+ <textarea id="chatInput" rows="3" placeholder="Type your message..."></textarea>
209
+ <button onclick="sendMessage()">Send</button>
210
+ </div>
211
+ </div>
212
+
213
+ <!-- Resize Handle -->
214
+ <div class="resize-handle" id="resizeHandle"></div>
215
+
216
+ <!-- Marimo Sandbox Panel -->
217
+ <div class="marimo-panel hidden" id="marimoPanel">
218
+ <div class="marimo-header">
219
+ <h2>📓 Marimo Sandbox</h2>
220
+ <button class="toggle-btn active" id="toggleMarimoBtn" onclick="toggleMarimo()">Hide Sandbox</button>
221
+ </div>
222
+ <iframe
223
+ class="marimo-frame"
224
+ id="marimoFrame"
225
+ src="http://localhost:8080"
226
+ sandbox="allow-scripts allow-same-origin allow-downloads"
227
+ ></iframe>
228
+ </div>
229
+ </div>
230
+
231
+ <script>
232
+ const chatPanel = document.getElementById('chatPanel');
233
+ const marimoPanel = document.getElementById('marimoPanel');
234
+ const chatBody = document.getElementById('chatBody');
235
+ const chatInput = document.getElementById('chatInput');
236
+ const resizeHandle = document.getElementById('resizeHandle');
237
+
238
+ // Toggle Marimo Sandbox
239
+ function toggleMarimo() {
240
+ marimoPanel.classList.toggle('hidden');
241
+ const btn = document.getElementById('toggleMarimoBtn');
242
+ btn.textContent = marimoPanel.classList.contains('hidden') ? 'Show Sandbox' : 'Hide Sandbox';
243
+ btn.classList.toggle('active');
244
+ }
245
+
246
+ // Toggle Chat Panel
247
+ function toggleChat() {
248
+ chatPanel.classList.toggle('collapsed');
249
+ const btn = document.getElementById('toggleChatBtn');
250
+ btn.textContent = chatPanel.classList.contains('collapsed') ? 'Show Chat' : 'Hide Chat';
251
+ }
252
+
253
+ // Send Message (simulated - replace with actual Agent Zero API call)
254
+ async function sendMessage() {
255
+ const message = chatInput.value.trim();
256
+ if (!message) return;
257
+
258
+ // Add user message
259
+ chatBody.innerHTML += `
260
+ <div class="message user">
261
+ <strong>You:</strong>
262
+ <p>${escapeHtml(message)}</p>
263
+ </div>
264
+ `;
265
+
266
+ chatInput.value = '';
267
+ chatBody.scrollTop = chatBody.scrollHeight;
268
+
269
+ // Call Agent Zero API (replace with actual endpoint)
270
+ try {
271
+ const response = await fetch('http://localhost:80/chat', {
272
+ method: 'POST',
273
+ headers: { 'Content-Type': 'application/json' },
274
+ body: JSON.stringify({ message })
275
+ });
276
+ const data = await response.json();
277
+
278
+ chatBody.innerHTML += `
279
+ <div class="message assistant">
280
+ <strong>Agent Zero:</strong>
281
+ <p>${escapeHtml(data.response || 'No response')}</p>
282
+ </div>
283
+ `;
284
+ } catch (err) {
285
+ chatBody.innerHTML += `
286
+ <div class="message assistant">
287
+ <strong>Agent Zero:</strong>
288
+ <p>⚠️ Could not connect to Agent Zero. Make sure it's running on port 80.</p>
289
+ </div>
290
+ `;
291
+ }
292
+
293
+ chatBody.scrollTop = chatBody.scrollHeight;
294
+ }
295
+
296
+ // Escape HTML
297
+ function escapeHtml(text) {
298
+ const div = document.createElement('div');
299
+ div.textContent = text;
300
+ return div.innerHTML;
301
+ }
302
+
303
+ // Resize functionality
304
+ let isResizing = false;
305
+
306
+ resizeHandle.addEventListener('mousedown', (e) => {
307
+ isResizing = true;
308
+ document.body.style.cursor = 'col-resize';
309
+ });
310
+
311
+ document.addEventListener('mousemove', (e) => {
312
+ if (!isResizing) return;
313
+
314
+ const containerWidth = document.querySelector('.container').offsetWidth;
315
+ const newMarimoWidth = ((containerWidth - e.clientX) / containerWidth) * 100;
316
+
317
+ if (newMarimoWidth > 20 && newMarimoWidth < 80) {
318
+ marimoPanel.style.width = `${newMarimoWidth}%`;
319
+ chatPanel.style.flex = `0 0 ${100 - newMarimoWidth}%`;
320
+ }
321
+ });
322
+
323
+ document.addEventListener('mouseup', () => {
324
+ isResizing = false;
325
+ document.body.style.cursor = 'default';
326
+ });
327
+
328
+ // Enter to send
329
+ chatInput.addEventListener('keydown', (e) => {
330
+ if (e.key === 'Enter' && !e.shiftKey) {
331
+ e.preventDefault();
332
+ sendMessage();
333
+ }
334
+ });
335
+ </script>
336
+ </body>
337
+ </html>