forked from Tomobobo710/SimpleChatJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
339 lines (297 loc) · 17.7 KB
/
Copy pathindex.html
File metadata and controls
339 lines (297 loc) · 17.7 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.15, maximum-scale=5.0, user-scalable=yes">
<title>SimpleChatJS</title>
<link rel="stylesheet" href="src/css/style.css">
<link rel="stylesheet" href="src/css/syntax.css">
<link rel="stylesheet" href="src/css/context-menu.css">
</head>
<body>
<div class="aim-container">
<!-- Chat List Sidebar -->
<div class="chat-sidebar">
<div class="sidebar-header">
<div class="user-info">
<div class="user-name">SimpleChatJS User</div>
<div class="user-status">Online</div>
</div>
</div>
<div class="chat-controls">
<button id="newChatBtn" class="btn">New Chat</button>
<button id="settingsBtn" class="btn">Settings</button>
</div>
<div class="chat-list-header">
<span>Chat History</span>
<div class="conductor-toggle">
<label>
<input type="checkbox" id="conductorMode"> Conductor
</label>
</div>
</div>
<div id="chatList" class="chat-list">
<!-- Chat items will be populated here -->
</div>
</div>
<!-- Main Chat Area -->
<div class="chat-main">
<div class="chat-header">
<div class="chat-title-section">
<div class="chat-title" id="chatTitle">Select or create a new chat</div>
<div class="chat-info" id="chatInfo"></div>
</div>
<div class="model-selector-section">
<label for="mainModelSelect" class="model-label">Model:</label>
<select id="mainModelSelect" class="model-dropdown">
<option value="">Loading...</option>
</select>
</div>
</div>
<div id="messagesContainer" class="messages-container">
<div id="messages" class="messages"></div>
</div>
<div id="inputContainer" class="input-container">
<div class="input-row">
<textarea id="messageInput" placeholder="Type your message here..." rows="2"></textarea>
<button id="sendBtn" class="btn">Send</button>
</div>
<!-- File upload and main actions area -->
<div id="imageArea" class="image-area">
<div class="main-action-bar">
<input type="file" id="fileInput" accept="*" multiple style="display: none;">
<button id="addFileBtn" class="btn" title="Add files & images">
Add Files
</button>
<button id="toolsBtn" class="btn" title="Manage tools">
Tool Settings
</button>
</div>
<div id="imagePreviews" class="image-previews"></div>
<div id="documentPreviews" class="document-previews"></div>
</div>
</div>
</div>
</div>
<!-- Settings Modal -->
<div id="settingsModal" class="aim-modal hidden">
<div class="aim-modal-content">
<div class="aim-modal-header">
<span class="aim-modal-title">Settings</span>
<span class="close">×</span>
</div>
<!-- Tab Navigation -->
<div class="tab-navigation">
<button class="btn btn-tab active" data-tab="general">General</button>
<button class="btn btn-tab" data-tab="tokens">Tokens</button>
<button class="btn btn-tab" data-tab="mcp">MCP</button>
<button class="btn btn-tab" data-tab="debug">Debug</button>
<button class="btn btn-tab" data-tab="logging">Logging</button>
</div>
<!-- General Tab -->
<div id="generalTab" class="tab-content active">
<!-- Profile Management Section -->
<div class="settings-section">
<h3>Profiles</h3>
<div class="profile-row">
<label for="profileSelect">Active Profile:</label>
<select id="profileSelect" class="profile-dropdown">
<option value="Default">Default</option>
</select>
<input type="text" id="newProfileName" placeholder="New profile name" class="profile-name-input">
<button type="button" id="saveAsProfileBtn" class="btn">Save As New Profile</button>
<button type="button" id="deleteProfileBtn" class="btn btn-danger">Delete Profile</button>
</div>
</div>
<div class="settings-section">
<div class="api-config-header">
<h3>API Configuration</h3>
<button id="testConnectionBtn" class="test-connection-btn">Test Connection</button>
</div>
<label for="apiKey">API Key (optional for local APIs):</label>
<input type="password" id="apiKey" placeholder="Leave empty for local APIs like Ollama">
<label for="apiUrl">API URL (required):</label>
<input type="text" id="apiUrl" placeholder="http://localhost:11434/v1 (Ollama) or https://api.openai.com/v1">
<label for="modelName">Model:</label>
<div class="model-selector-container">
<select id="modelSelect" class="model-dropdown">
<option value="">-- Select a model --</option>
</select>
<input type="text" id="modelName" placeholder="Or enter custom model name" class="model-input">
<button type="button" id="refreshModelsBtn" class="refresh-models-btn" title="Refresh model list">🔄</button>
</div>
</div>
</div>
<!-- MCP Tab --> <!-- Tokens Tab -->
<div id="tokensTab" class="tab-content">
<!-- System Prompts Section -->
<div class="settings-section system-prompts-section">
<h3>System Prompts</h3>
<div class="checkbox-group">
<input type="checkbox" id="enableSystemPrompt" checked />
<label for="enableSystemPrompt">Enable System Prompt</label>
</div>
<p class="setting-description">Configure system instructions that guide AI behavior across all conversations. Applied automatically to the first message in each conversation.</p>
<div class="system-prompt-group" id="systemPromptGroup">
<label for="systemPrompt">System Prompt:</label>
<textarea id="systemPrompt" rows="4" placeholder="Enter system instructions..."></textarea>
<p class="setting-description">This prompt will be automatically added to the beginning of new conversations with all AI providers.</p>
</div>
</div>
<!-- Anthropic Thinking Section -->
<div class="settings-section thinking-section" data-provider="anthropic">
<h3>Anthropic (Claude) Thinking</h3>
<div class="checkbox-group">
<input type="checkbox" id="enableThinkingAnthropic" />
<label for="enableThinkingAnthropic">Enable Thinking Mode</label>
</div>
<p class="setting-description">Shows Claude's step-by-step reasoning process. Works with Claude 3.7 Sonnet and Claude 4 models. Thinking is OFF by default.</p>
<div class="thinking-budget-group" id="thinkingBudgetGroupAnthropic" style="display: none;">
<label for="thinkingBudgetAnthropic">Thinking Budget (tokens):</label>
<div class="budget-input-container">
<input type="range" id="thinkingBudgetAnthropic" min="1024" max="32000" step="1024" value="8192">
<span id="thinkingBudgetValueAnthropic">8192</span>
</div>
<div class="budget-presets">
<button type="button" class="budget-preset" data-target="thinkingBudgetAnthropic" data-value="1024">Light (1K)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetAnthropic" data-value="4096">Medium (4K)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetAnthropic" data-value="8192">High (8K)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetAnthropic" data-value="16384">Heavy (16K)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetAnthropic" data-value="32000">Max (32K)</button>
</div>
<p class="setting-description">Higher budgets allow more thorough reasoning but cost more tokens. Range: 1024-32000</p>
</div>
</div>
<!-- Google Thinking Section -->
<div class="settings-section thinking-section" data-provider="google">
<h3>Google (Gemini) Thinking</h3>
<div class="checkbox-group">
<input type="checkbox" id="enableThinkingGoogle" />
<label for="enableThinkingGoogle">Enable Thinking Mode</label>
</div>
<p class="setting-description">Controls Gemini's internal reasoning process. Works with Gemini 2.5 Pro, Flash, and Flash-Lite models. Thinking is ON by default for 2.5 models.</p>
<div class="thinking-budget-group" id="thinkingBudgetGroupGoogle" style="display: none;">
<label for="thinkingBudgetGoogle">Thinking Budget (tokens):</label>
<div class="budget-input-container">
<input type="range" id="thinkingBudgetGoogle" min="-1" max="24576" step="512" value="8192">
<span id="thinkingBudgetValueGoogle">8192</span>
</div>
<div class="budget-presets">
<button type="button" class="budget-preset" data-target="thinkingBudgetGoogle" data-value="0">Off (0)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetGoogle" data-value="-1">Auto (-1)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetGoogle" data-value="4096">Light (4K)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetGoogle" data-value="8192">Medium (8K)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetGoogle" data-value="16384">Heavy (16K)</button>
<button type="button" class="budget-preset" data-target="thinkingBudgetGoogle" data-value="24576">Max (24K)</button>
</div>
<p class="setting-description">Range: 0-24576. Use 0 to disable, -1 for auto-budget, or set a specific limit.</p>
</div>
</div>
</div>
<div id="mcpTab" class="tab-content">
<div class="settings-section">
<div class="mcp-controls">
<button id="refreshMcpBtn" class="btn">Refresh MCP Servers</button>
<button id="mcpConfigBtn" class="btn">MCP Config</button>
</div>
<div id="mcpServers">
<p>Loading MCP servers...</p>
</div>
</div>
</div>
<!-- Debug Tab -->
<div id="debugTab" class="tab-content">
<div class="settings-section">
<h3>Debug Options</h3>
<div class="checkbox-group">
<input type="checkbox" id="debugPanels" />
<label for="debugPanels">Show debug panels (+ button on messages)</label>
</div>
<p class="setting-description">Enable debug information panels that show API requests, tool filtering, and response metadata for each message.</p>
<div class="checkbox-group">
<input type="checkbox" id="showPhaseMarkers" />
<label for="showPhaseMarkers">Show phase markers (conductor mode)</label>
</div>
<p class="setting-description">Display visual phase markers during conductor mode conversations showing current phase progress.</p>
</div>
</div>
<!-- Logging Tab -->
<div id="loggingTab" class="tab-content">
<div class="settings-section">
<h3>Logging</h3>
<label for="logLevel">Log Level:</label>
<select id="logLevel">
<option value="DEBUG">DEBUG (All logs)</option>
<option value="INFO" selected>INFO (Normal operation)</option>
<option value="WARN">WARN (Warnings and errors)</option>
<option value="ERROR">ERROR (Errors only)</option>
</select>
</div>
</div>
<button id="saveSettings" class="btn">Save Settings</button>
</div>
</div>
<!-- MCP Config Modal -->
<div id="mcpConfigModal" class="aim-modal hidden">
<div class="aim-modal-content" style="max-width: 800px;">
<div class="aim-modal-header">
<span class="aim-modal-title">MCP Configuration</span>
<span class="close-mcp">×</span>
</div>
<p>Configure MCP servers using Claude Desktop JSON format:</p>
<div class="settings-section">
<label for="mcpConfigText">MCP Config JSON:</label>
<textarea id="mcpConfigText" rows="20" placeholder='{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/files"]
},
"brave-search": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": {
"BRAVE_API_KEY": "your-api-key"
}
}
}
}'></textarea>
</div>
<div class="button-group">
<button id="saveMcpConfig" class="btn">Save MCP Config</button>
<button id="testMcpConfig" class="btn">Check JSON Format</button>
</div>
</div>
</div>
</div>
<!-- 1998-style script tags -->
<!-- Core app utilities -->
<script src="src/js/app/logger.js"></script>
<script src="src/js/app/utils.js"></script>
<script src="src/js/app/imageProcessing.js"></script>
<!-- Document processing (server-side via API) -->
<script src="src/js/app/documentProcessing.js"></script>
<script src="src/js/app/api.js"></script>
<!-- Rendering system -->
<script src="src/js/render/streamingDropdowns.js"></script>
<script src="src/js/render/streamingMessageProcessor.js"></script>
<script src="src/js/render/chatRenderer.js"></script>
<script src="src/js/render/liveRenderer.js"></script>
<!-- Tools -->
<script src="src/js/tools/mcp.js"></script>
<script src="src/js/tools/toolHandler.js"></script>
<!-- UI components -->
<script src="src/js/ui/debugPanel.js"></script>
<script src="src/js/ui/settings.js"></script>
<script src="src/js/ui/ui.js"></script>
<script src="src/js/ui/contextMenu.js"></script>
<!-- Chat functionality -->
<script src="src/js/chat/conductorDebugData.js"></script>
<script src="src/js/chat/conductor.js"></script>
<script src="src/js/chat/simpleChatMode.js"></script>
<script src="src/js/chat/chatManager.js"></script>
<!-- Main application -->
<script src="src/js/utils/simpleSyntax.js"></script>
<script src="src/js/app/main.js"></script>
</body>
</html>