File size: 1,708 Bytes
3408f15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html>
<head>
  <title>OpenManus2</title>
</head>
<body>
  <h1>Welcome to OpenManus2</h1>
  <p><a href="/chat?theme=openmanus">Start Chat</a></p>
</body>
</html>

# templates/chat.html
<!DOCTYPE html>
<html>
<head>
  <title>OpenManus Chat</title>
</head>
<body>
  <h2>Chat with OpenManus</h2>
  <form id="prompt-form">
    <textarea id="prompt" rows="4" cols="50" placeholder="Type your prompt..."></textarea>
    <br>
    <button type="submit">Submit</button>
  </form>
  <div id="output"></div>

  <script>
    document.getElementById("prompt-form").addEventListener("submit", async function(e) {
      e.preventDefault();
      const prompt = document.getElementById("prompt").value;
      const res = await fetch("/tasks", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ prompt })
      });
      const { task_id } = await res.json();
      const events = new EventSource(`/tasks/${task_id}/events`);
      events.onmessage = function(event) {
        const data = JSON.parse(event.data);
        document.getElementById("output").innerText += `\n${data.result || data.message || JSON.stringify(data)}`;
      };
    });
  </script>
</body>
</html>

# static/themes/openmanus/theme.json
{
  "name": "OpenManus",
  "description": "Default theme for OpenManus2 agent UI."
}

# static/themes/openmanus/templates/chat.html
<!-- Optional custom theme chat.html -->
<!-- Copy of /templates/chat.html or custom variant -->
<!DOCTYPE html>
<html>
<head>
  <title>OpenManus - Themed Chat</title>
</head>
<body>
  <h2>Welcome to the themed chat interface</h2>
  <p>Use the default chat UI or customize this page.</p>
</body>
</html>