Ken Sang Tang commited on
Commit
3408f15
·
verified ·
1 Parent(s): d162c63

Create template/index.html

Browse files
Files changed (1) hide show
  1. template/index.html +65 -0
template/index.html ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>OpenManus2</title>
5
+ </head>
6
+ <body>
7
+ <h1>Welcome to OpenManus2</h1>
8
+ <p><a href="/chat?theme=openmanus">Start Chat</a></p>
9
+ </body>
10
+ </html>
11
+
12
+ # templates/chat.html
13
+ <!DOCTYPE html>
14
+ <html>
15
+ <head>
16
+ <title>OpenManus Chat</title>
17
+ </head>
18
+ <body>
19
+ <h2>Chat with OpenManus</h2>
20
+ <form id="prompt-form">
21
+ <textarea id="prompt" rows="4" cols="50" placeholder="Type your prompt..."></textarea>
22
+ <br>
23
+ <button type="submit">Submit</button>
24
+ </form>
25
+ <div id="output"></div>
26
+
27
+ <script>
28
+ document.getElementById("prompt-form").addEventListener("submit", async function(e) {
29
+ e.preventDefault();
30
+ const prompt = document.getElementById("prompt").value;
31
+ const res = await fetch("/tasks", {
32
+ method: "POST",
33
+ headers: { "Content-Type": "application/json" },
34
+ body: JSON.stringify({ prompt })
35
+ });
36
+ const { task_id } = await res.json();
37
+ const events = new EventSource(`/tasks/${task_id}/events`);
38
+ events.onmessage = function(event) {
39
+ const data = JSON.parse(event.data);
40
+ document.getElementById("output").innerText += `\n${data.result || data.message || JSON.stringify(data)}`;
41
+ };
42
+ });
43
+ </script>
44
+ </body>
45
+ </html>
46
+
47
+ # static/themes/openmanus/theme.json
48
+ {
49
+ "name": "OpenManus",
50
+ "description": "Default theme for OpenManus2 agent UI."
51
+ }
52
+
53
+ # static/themes/openmanus/templates/chat.html
54
+ <!-- Optional custom theme chat.html -->
55
+ <!-- Copy of /templates/chat.html or custom variant -->
56
+ <!DOCTYPE html>
57
+ <html>
58
+ <head>
59
+ <title>OpenManus - Themed Chat</title>
60
+ </head>
61
+ <body>
62
+ <h2>Welcome to the themed chat interface</h2>
63
+ <p>Use the default chat UI or customize this page.</p>
64
+ </body>
65
+ </html>