-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
255 lines (249 loc) · 7.76 KB
/
index.html
File metadata and controls
255 lines (249 loc) · 7.76 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>AI Chat</title>
<link
rel="stylesheet"
href="/ui/style.css"
/>
</head>
<body>
<div class="chat-shell">
<div class="chat-container">
<div class="chat-header">
<div class="header-left">
<div class="brand">
<div class="brand-dot"></div>
<div class="brand-text">
<h1>AgenticHub</h1>
</div>
</div>
</div>
<div class="header-right">
<button
class="icon-btn"
id="clearButton"
data-ah-ref="clear"
title="清空对话"
aria-label="清空对话"
>
<!-- trash icon -->
<svg
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
aria-hidden="true"
>
<path
d="M9 3h6m-9 4h12m-10 0 1 16h6l1-16M10 7v14m4-14v14"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
</svg>
</button>
</div>
</div>
<div
class="chat-messages"
id="chatMessages"
data-ah-ref="messages"
>
<div class="welcome-message">
<div class="welcome-card">
<div class="welcome-title">你好!</div>
<div class="welcome-text">
有什么可以帮助你的吗?你也可以试试发一段代码或需求。
</div>
<div
class="welcome-chips"
id="quickChips"
data-ah-ref="chips"
>
<button
class="chip"
data-text="你好,我想开始一段对话"
>
开始对话
</button>
<button
class="chip"
data-text="我需要一些帮助和建议"
>
寻求帮助
</button>
<button
class="chip"
data-text="请介绍一下你能帮我做什么"
>
探索功能
</button>
</div>
</div>
</div>
</div>
<div class="chat-input-area">
<div class="input-wrap">
<textarea
id="chatInput"
data-ah-ref="input"
placeholder="输入你的消息…(Enter 发送,Shift+Enter 换行)"
rows="1"
></textarea>
<div class="input-actions">
<button
class="icon-btn"
id="scrollToBottom"
data-ah-ref="scroll"
title="回到底部"
aria-label="回到底部"
>
<!-- down icon -->
<svg
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
aria-hidden="true"
>
<path
d="M12 5v12m0 0 5-5m-5 5-5-5"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</button>
<button
class="icon-btn"
id="uploadButton"
data-ah-ref="upload"
title="上传图片"
aria-label="上传图片"
>
<!-- upload/image icon -->
<svg
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
aria-hidden="true"
>
<path
d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<polyline
points="17 8 12 3 7 8"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<line
x1="12"
y1="3"
x2="12"
y2="15"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
</svg>
</button>
<input
type="file"
id="fileInput"
data-ah-ref="file"
accept="image/*"
style="display: none"
/>
<button
id="sendButton"
data-ah-ref="send"
class="send-btn"
>
<span class="send-text">发送</span>
<!-- send icon -->
<svg
class="send-icon"
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
aria-hidden="true"
>
<path
d="M22 2 11 13"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
<path
d="M22 2 15 22l-4-9-9-4 20-7Z"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</button>
</div>
</div>
<div class="helper-row">
<span class="hint">Enter 发送 · Shift+Enter 换行</span>
<span
class="status"
id="connStatus"
data-ah-ref="status"
>● 在线</span
>
</div>
</div>
</div>
</div>
<script src="/ui/sdk.js"></script>
<script src="/ui/renderer.js"></script>
<script src="/ui/app.js"></script>
<!-- 可选:一些轻量 UI 行为(不影响你现有 app.js 的消息逻辑) -->
<script>
// 回到底部
const scrollBtn = document.getElementById('scrollToBottom')
if (scrollBtn && chatMessages) {
const scrollToBottom = () =>
(chatMessages.scrollTop = chatMessages.scrollHeight)
scrollBtn.addEventListener('click', scrollToBottom)
// 当用户不在底部时显示按钮
const toggle = () => {
const nearBottom =
chatMessages.scrollHeight -
chatMessages.scrollTop -
chatMessages.clientHeight <
80
scrollBtn.style.opacity = nearBottom ? '0' : '1'
scrollBtn.style.pointerEvents = nearBottom ? 'none' : 'auto'
}
chatMessages.addEventListener('scroll', toggle)
setTimeout(toggle, 300)
}
// 清空对话(仅清空 UI;如你有后端历史,请按需改)
if (clearButton && chatMessages) {
clearButton.addEventListener('click', () => {
const keep = chatMessages.querySelector('.welcome-message')
chatMessages.innerHTML = ''
if (keep) chatMessages.appendChild(keep)
})
}
</script>
</body>
</html>