-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
222 lines (214 loc) · 11.6 KB
/
index.html
File metadata and controls
222 lines (214 loc) · 11.6 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="ChatBot">
<meta name="theme-color" content="#6366f1">
<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="icons/icon-192.png">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
<title>ChatBot Pro</title>
</head>
<body>
<!-- 侧边栏 -->
<div id="sidebar" class="sidebar">
<div class="sidebar-header">
<h2>对话</h2>
<button id="btn-new-chat" class="icon-btn" title="新对话">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
</button>
</div>
<div id="session-list" class="session-list"></div>
<div class="sidebar-footer">
<button id="btn-settings" class="sidebar-btn">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>
设置
</button>
</div>
</div>
<!-- 遮罩层(移动端) -->
<div id="overlay" class="overlay"></div>
<!-- 主聊天区 -->
<div id="main" class="main">
<!-- 顶栏 -->
<div class="topbar">
<button id="btn-menu" class="icon-btn menu-btn">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<select id="provider-select" class="provider-select" title="切换服务商"></select>
<select id="model-select" class="model-select"></select>
<span id="token-count" class="token-count"></span>
<button id="btn-export" class="icon-btn" title="导出">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
</button>
</div>
<!-- 消息区 -->
<div id="messages" class="messages">
<div id="empty-state" class="empty-state">
<div class="empty-icon">💬</div>
<p>开始新对话</p>
</div>
</div>
<!-- 输入区 -->
<div class="input-area">
<div id="image-preview" class="image-preview" style="display:none">
<span>📷 已选择图片</span>
<button id="btn-clear-img" class="icon-btn-sm">✕</button>
</div>
<div class="input-row">
<label class="icon-btn" id="btn-image" title="发送图片">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
<input type="file" id="image-input" accept="image/*" style="display:none">
</label>
<button class="icon-btn deep-research-btn" id="btn-deep-research" title="深度研究">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>
</button>
<button class="icon-btn search-toggle" id="btn-search-toggle" title="联网搜索: 关">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>
</button>
<textarea id="msg-input" class="msg-input" placeholder="输入消息..." rows="1"></textarea>
<button id="btn-send" class="send-btn" disabled>
<svg id="send-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
<svg id="stop-icon" width="20" height="20" viewBox="0 0 24 24" fill="currentColor" style="display:none"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>
</button>
</div>
</div>
</div>
<!-- 深度研究面板 -->
<div id="dr-panel" class="dr-panel">
<div class="dr-panel-header">
<div class="dr-panel-title">
<div class="dr-panel-icon">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
</div>
<span>深度研究</span>
</div>
<div class="dr-panel-meta">
<span id="dr-timer" class="dr-timer-text">00:00</span>
<button id="dr-stop-btn" class="dr-stop-btn" title="停止研究">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>
</button>
<button id="dr-close-btn" class="dr-close-btn" title="关闭面板">✕</button>
</div>
</div>
<div class="dr-panel-progress">
<div class="dr-panel-progress-fill" id="dr-progress-fill"></div>
</div>
<div class="dr-panel-body">
<!-- 研究计划(可折叠)-->
<div id="dr-plan-section" class="dr-collapsible-section" style="display:none">
<button class="dr-collapse-btn" onclick="this.parentElement.classList.toggle('collapsed')">
<span class="dr-section-label">研究计划</span>
<svg class="dr-chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>
</button>
<div class="dr-collapse-body">
<div id="dr-plan-text" class="dr-plan-text"></div>
</div>
</div>
<!-- 研究步骤(可折叠)-->
<div id="dr-steps-section" class="dr-collapsible-section">
<button class="dr-collapse-btn" onclick="this.parentElement.classList.toggle('collapsed')">
<span class="dr-section-label">研究步骤 <span id="dr-step-count"></span></span>
<svg class="dr-chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>
</button>
<div class="dr-collapse-body">
<div id="dr-steps-list" class="dr-steps-list"></div>
</div>
</div>
<!-- 来源(可折叠)-->
<div id="dr-sources-panel" class="dr-collapsible-section" style="display:none">
<button class="dr-collapse-btn" onclick="this.parentElement.classList.toggle('collapsed')">
<span class="dr-section-label">已收集来源 <span id="dr-source-count" class="dr-badge">0</span></span>
<svg class="dr-chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>
</button>
<div class="dr-collapse-body">
<div id="dr-sources-chips" class="dr-sources-chips"></div>
</div>
</div>
</div>
</div>
<div id="dr-overlay" class="dr-overlay" style="display:none"></div>
<!-- 设置弹窗 -->
<div id="settings-modal" class="modal" style="display:none">
<div class="modal-content">
<div class="modal-header">
<h3>设置</h3>
<button class="icon-btn modal-close" data-modal="settings-modal">✕</button>
</div>
<div class="modal-body">
<label>服务商管理</label>
<div id="cfg-providers" class="providers-list"></div>
<div class="provider-add-row">
<input id="cfg-prov-name" type="text" placeholder="服务商名称(如 Rabbit)" style="flex:1">
<input id="cfg-prov-url" type="url" placeholder="Base URL" style="flex:2">
<input id="cfg-prov-key" type="password" placeholder="API Key" style="flex:2">
<button id="btn-add-provider" class="secondary-btn" style="white-space:nowrap">添加</button>
</div>
<label>当前手动配置(不使用服务商时)</label>
<label>API Base URL</label>
<input id="cfg-url" type="url" placeholder="https://api.example.com">
<label>API Key</label>
<input id="cfg-key" type="password" placeholder="sk-...">
<label>默认 System Prompt</label>
<textarea id="cfg-prompt" rows="4" placeholder="You are a helpful assistant."></textarea>
<label>默认模型</label>
<select id="cfg-default-model"></select>
<label>模型列表</label>
<div id="cfg-model-list" class="model-list-box">点击「刷新模型列表」加载</div>
<label>主题</label>
<select id="cfg-theme">
<option value="system">跟随系统</option>
<option value="light">浅色</option>
<option value="dark">深色</option>
</select>
<label>联网搜索模式</label>
<select id="cfg-search-mode">
<option value="off">关闭</option>
<option value="on">手动开关</option>
<option value="auto">AI 自动决策</option>
</select>
<label>联网搜索结果数量</label>
<select id="cfg-search-count">
<option value="3">3 条</option>
<option value="5">5 条</option>
<option value="8">8 条</option>
</select>
<label>Tavily Search API Key <a href="https://tavily.com" target="_blank" style="color:var(--accent);font-weight:400">(免费1000次/月)</a></label>
<input id="cfg-tavily-key" type="password" placeholder="tvly-...">
<label>搜索代理地址 <span style="font-weight:400;color:var(--text3)">(自建Worker,免费无限)</span></label>
<input id="cfg-search-worker" type="url" placeholder="https://your-worker.workers.dev">
<div class="modal-actions">
<button id="btn-fetch-models" class="secondary-btn">刷新模型列表</button>
<button id="btn-save-settings" class="primary-btn">保存</button>
</div>
<div class="stats">
<span id="stat-sessions">对话: 0</span>
<span id="stat-tokens">Tokens: 0</span>
</div>
</div>
</div>
</div>
<!-- 导出弹窗 -->
<div id="export-modal" class="modal" style="display:none">
<div class="modal-content modal-sm">
<div class="modal-header">
<h3>导出对话</h3>
<button class="icon-btn modal-close" data-modal="export-modal">✕</button>
</div>
<div class="modal-body">
<button class="export-btn" data-format="markdown">📄 Markdown</button>
<button class="export-btn" data-format="text">📝 纯文本</button>
<button class="export-btn" data-format="json">🔧 JSON</button>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.0/marked.min.js"></script>
<script src="js/deep-research.js"></script>
<script src="js/app.js"></script>
</body>
</html>