Spaces:
Runtime error
Runtime error
Delete public/index.html
Browse files- public/index.html +0 -129
public/index.html
DELETED
|
@@ -1,129 +0,0 @@
|
|
| 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>OpenClaw Chat</title>
|
| 7 |
-
<style>
|
| 8 |
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 9 |
-
body {
|
| 10 |
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| 11 |
-
background: #1a1a2e;
|
| 12 |
-
color: #eee;
|
| 13 |
-
height: 100vh;
|
| 14 |
-
display: flex;
|
| 15 |
-
flex-direction: column;
|
| 16 |
-
}
|
| 17 |
-
.header {
|
| 18 |
-
background: #16213e;
|
| 19 |
-
padding: 1rem;
|
| 20 |
-
border-bottom: 1px solid #0f3460;
|
| 21 |
-
}
|
| 22 |
-
.header h1 { font-size: 1.2rem; color: #e94560; }
|
| 23 |
-
.header .status { font-size: 0.8rem; color: #4ade80; margin-top: 0.3rem; }
|
| 24 |
-
#chat {
|
| 25 |
-
flex: 1;
|
| 26 |
-
overflow-y: auto;
|
| 27 |
-
padding: 1rem;
|
| 28 |
-
display: flex;
|
| 29 |
-
flex-direction: column;
|
| 30 |
-
gap: 1rem;
|
| 31 |
-
}
|
| 32 |
-
.msg {
|
| 33 |
-
max-width: 85%;
|
| 34 |
-
padding: 0.8rem 1rem;
|
| 35 |
-
border-radius: 12px;
|
| 36 |
-
white-space: pre-wrap;
|
| 37 |
-
word-wrap: break-word;
|
| 38 |
-
}
|
| 39 |
-
.msg.user { align-self: flex-end; background: #e94560; color: white; }
|
| 40 |
-
.msg.bot { align-self: flex-start; background: #16213e; border: 1px solid #0f3460; }
|
| 41 |
-
.msg.error { background: #4a1a1a; border-color: #e94560; }
|
| 42 |
-
.input-area {
|
| 43 |
-
background: #16213e;
|
| 44 |
-
padding: 1rem;
|
| 45 |
-
border-top: 1px solid #0f3460;
|
| 46 |
-
display: flex;
|
| 47 |
-
gap: 0.5rem;
|
| 48 |
-
}
|
| 49 |
-
input {
|
| 50 |
-
flex: 1;
|
| 51 |
-
background: #1a1a2e;
|
| 52 |
-
border: 1px solid #0f3460;
|
| 53 |
-
border-radius: 8px;
|
| 54 |
-
padding: 0.8rem 1rem;
|
| 55 |
-
color: #eee;
|
| 56 |
-
font-size: 1rem;
|
| 57 |
-
outline: none;
|
| 58 |
-
}
|
| 59 |
-
input:focus { border-color: #e94560; }
|
| 60 |
-
input:disabled { opacity: 0.5; }
|
| 61 |
-
button {
|
| 62 |
-
background: #e94560;
|
| 63 |
-
color: white;
|
| 64 |
-
border: none;
|
| 65 |
-
border-radius: 8px;
|
| 66 |
-
padding: 0.8rem 1.5rem;
|
| 67 |
-
font-size: 1rem;
|
| 68 |
-
cursor: pointer;
|
| 69 |
-
}
|
| 70 |
-
button:hover { background: #c73e54; }
|
| 71 |
-
button:disabled { background: #555; cursor: not-allowed; }
|
| 72 |
-
</style>
|
| 73 |
-
</head>
|
| 74 |
-
<body>
|
| 75 |
-
<div class="header">
|
| 76 |
-
<h1>๐ฆ OpenClaw</h1>
|
| 77 |
-
<div class="status" id="status">Connected</div>
|
| 78 |
-
</div>
|
| 79 |
-
<div id="chat"></div>
|
| 80 |
-
<div class="input-area">
|
| 81 |
-
<input type="text" id="input" placeholder="Type your message..." autocomplete="off">
|
| 82 |
-
<button id="send" onclick="send()">Send</button>
|
| 83 |
-
</div>
|
| 84 |
-
<script>
|
| 85 |
-
const chat = document.getElementById('chat');
|
| 86 |
-
const input = document.getElementById('input');
|
| 87 |
-
const sendBtn = document.getElementById('send');
|
| 88 |
-
const sessionId = 'web-' + Math.random().toString(36).substr(2, 9);
|
| 89 |
-
|
| 90 |
-
function add(text, cls) {
|
| 91 |
-
const div = document.createElement('div');
|
| 92 |
-
div.className = 'msg ' + cls;
|
| 93 |
-
div.textContent = text;
|
| 94 |
-
chat.appendChild(div);
|
| 95 |
-
chat.scrollTop = chat.scrollHeight;
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
async function send() {
|
| 99 |
-
const text = input.value.trim();
|
| 100 |
-
if (!text) return;
|
| 101 |
-
|
| 102 |
-
add(text, 'user');
|
| 103 |
-
input.value = '';
|
| 104 |
-
input.disabled = true;
|
| 105 |
-
sendBtn.disabled = true;
|
| 106 |
-
|
| 107 |
-
try {
|
| 108 |
-
const res = await fetch('/chat', {
|
| 109 |
-
method: 'POST',
|
| 110 |
-
headers: { 'Content-Type': 'application/json' },
|
| 111 |
-
body: JSON.stringify({ message: text, sessionId })
|
| 112 |
-
});
|
| 113 |
-
|
| 114 |
-
const data = await res.json();
|
| 115 |
-
add(data.reply || data.error || JSON.stringify(data), data.error ? 'bot error' : 'bot');
|
| 116 |
-
} catch (err) {
|
| 117 |
-
add('Connection error: ' + err.message, 'bot error');
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
input.disabled = false;
|
| 121 |
-
sendBtn.disabled = false;
|
| 122 |
-
input.focus();
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
input.onkeypress = (e) => { if (e.key === 'Enter') send(); };
|
| 126 |
-
input.focus();
|
| 127 |
-
</script>
|
| 128 |
-
</body>
|
| 129 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|