-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.html
More file actions
565 lines (527 loc) · 27 KB
/
settings.html
File metadata and controls
565 lines (527 loc) · 27 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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SideLlama Settings</title>
<script src="tailwind.js"></script>
<style>
:root {
--background: 0 0% 3.9%;
--foreground: 0 0% 98%;
--card: 0 0% 3.9%;
--card-foreground: 0 0% 98%;
--primary: 0 0% 98%;
--primary-foreground: 0 0% 9%;
--secondary: 0 0% 14.9%;
--secondary-foreground: 0 0% 98%;
--muted: 0 0% 14.9%;
--muted-foreground: 0 0% 63.9%;
--accent: 0 0% 14.9%;
--accent-foreground: 0 0% 98%;
--border: 0 0% 14.9%;
--input: 0 0% 14.9%;
--ring: 0 0% 63.9%;
}
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: hsl(var(--background));
color: hsl(var(--foreground));
}
.scrollbar-none::-webkit-scrollbar {
display: none;
}
.scrollbar-none {
-ms-overflow-style: none;
scrollbar-width: none;
}
.setting-card {
background: hsl(var(--card));
border: 1px solid hsl(var(--border));
border-radius: 12px;
padding: 20px;
margin-bottom: 16px;
}
.setting-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 0;
border-bottom: 1px solid hsl(var(--border));
}
.setting-item:last-child {
border-bottom: none;
}
.toggle-switch {
position: relative;
width: 44px;
height: 24px;
background: #374151; /* Dark gray for inactive */
border-radius: 12px;
cursor: pointer;
transition: all 0.3s ease;
border: 1px solid #4b5563;
}
.toggle-switch.active {
background: #22c55e; /* Bright green for active */
border-color: #16a34a;
box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}
.toggle-switch::after {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 18px;
height: 18px;
background: white;
border-radius: 50%;
transition: all 0.3s ease;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle-switch.active::after {
transform: translateX(18px);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.toggle-switch:hover {
opacity: 0.9;
}
input, select, textarea {
background-color: hsl(var(--input));
color: hsl(var(--foreground));
border: 1px solid hsl(var(--border));
}
select option {
background-color: hsl(var(--background));
color: hsl(var(--foreground));
}
textarea {
font-family: inherit;
resize: vertical;
}
.feature-badge {
background: linear-gradient(45deg, #22c55e, #3b82f6);
color: white;
padding: 2px 8px;
border-radius: 12px;
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
}
.tool-badge {
background: hsl(var(--accent));
color: hsl(var(--accent-foreground));
padding: 4px 8px;
border-radius: 8px;
font-size: 12px;
font-weight: 500;
}
</style>
</head>
<body>
<div class="bg-background min-h-screen">
<!-- Header -->
<div class="border-b px-6 py-4">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<span class="relative flex shrink-0 overflow-hidden ring-border size-10 rounded-xl bg-white p-0.5 ring">
<div class="aspect-square size-full bg-blue-500 rounded-lg flex items-center justify-center text-white font-bold">
🦙
</div>
</span>
<div>
<h1 class="text-xl font-semibold">SideLlama Settings</h1>
<p class="text-muted-foreground text-sm">Configure your AI assistant</p>
</div>
</div>
<button id="closeSettings" class="text-muted-foreground hover:text-foreground">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 6L6 18M6 6l12 12"/>
</svg>
</button>
</div>
</div>
<!-- Main Content -->
<div class="p-6 max-w-4xl mx-auto">
<!-- Ollama Configuration -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
🔧 Ollama Configuration
</h2>
<div class="setting-item">
<div>
<div class="font-medium">Ollama Server URL</div>
<div class="text-sm text-muted-foreground">The URL where Ollama is running</div>
</div>
<input type="text" id="ollamaUrl" class="bg-input border border-border rounded-md px-3 py-2 text-sm w-48" value="http://localhost:11434">
</div>
<div class="setting-item">
<div>
<div class="font-medium">Connection Status</div>
<div class="text-sm text-muted-foreground">Current connection to Ollama</div>
</div>
<div id="connectionStatus" class="text-sm px-3 py-1 rounded-full bg-gray-500 text-white">
Checking...
</div>
</div>
</div>
<!-- Tool Calling Features -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
🛠️ Tool Calling Features
<span class="feature-badge">New in 2024</span>
</h2>
<div class="setting-item">
<div>
<div class="font-medium">Enable Tool Calls</div>
<div class="text-sm text-muted-foreground">Allow AI to use built-in tools for enhanced capabilities</div>
</div>
<div class="toggle-switch active" id="toolCallsToggle"></div>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Auto-Manage Tool Calls</div>
<div class="text-sm text-muted-foreground">Automatically disable tool calls for vision models and enable for tool-capable models</div>
</div>
<div class="toggle-switch active" id="autoManageToolCallsToggle"></div>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Enable Thinking Mode</div>
<div class="text-sm text-muted-foreground">Allow thinking models to show reasoning process for complex queries</div>
</div>
<div class="toggle-switch active" id="enableThinkingToggle"></div>
</div>
<div class="mt-4">
<div class="text-sm font-medium mb-2">Available Tools:</div>
<div class="grid grid-cols-2 gap-2">
<div class="tool-badge">🔍 Web Search</div>
<div class="tool-badge">📄 Webpage Scraping</div>
<div class="tool-badge">📸 Screenshot Capture</div>
<div class="tool-badge">🌐 Page Context</div>
</div>
</div>
</div>
<!-- Model Configuration -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4">🤖 Model Configuration</h2>
<div class="setting-item">
<div>
<div class="font-medium">Default Model</div>
<div class="text-sm text-muted-foreground">The model to use by default</div>
</div>
<select id="defaultModel" class="bg-input border border-border rounded-md px-3 py-2 text-sm">
<option value="qwen2.5:7b">qwen2.5:7b</option>
</select>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Streaming Responses</div>
<div class="text-sm text-muted-foreground">Show responses as they're generated</div>
</div>
<div class="toggle-switch" id="streamingToggle"></div>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Context Length</div>
<div class="text-sm text-muted-foreground">Maximum context window (32k+ recommended for tools)</div>
</div>
<select id="contextLength" class="bg-input border border-border rounded-md px-3 py-2 text-sm">
<option value="8192">8K</option>
<option value="16384">16K</option>
<option value="32768">32K</option>
<option value="65536">64K</option>
<option value="128000" selected>128K (Ollama Max)</option>
</select>
</div>
<div class="pt-4">
<div class="font-medium">System Prompt</div>
<div class="text-sm text-muted-foreground mb-2">The instructions given to the AI at the start of every conversation</div>
<textarea id="systemPrompt" class="bg-input border border-border rounded-md px-3 py-2 text-sm w-full h-32 resize-y" placeholder="You are SideLlama, a sophisticated and friendly AI assistant integrated into your browser. You are a knowledgeable and helpful companion for a wide range of tasks, from quick questions to in-depth research.
**Your Persona:**
- You are intelligent, kind, and proactive. You can lead the conversation and suggest new directions.
- You are a master of markdown and use it to create beautiful, easy-to-read responses.
- You enjoy thoughtful discussions about science, philosophy, and technology.
**Your Capabilities:**
- **Web Search:** You can search the web for up-to-date information.
- **Vision:** You can analyze images and screenshots.
- **Code Generation:** You can write and format code in various languages. You will always add comments to your code to explain what it does.
- **Markdown Formatting:** You can create beautiful and easy-to-read responses using markdown.
**Output Format:**
- Use markdown for all responses.
- Use headings, lists, and tables to organize information.
- Use code blocks for code snippets, and always add comments to your code.
- Use bold and italics to emphasize key points.
- Keep your responses concise and to the point."></textarea>
</div>
</div>
<!-- Advanced Parameters -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
⚙️ Advanced Parameters
<span class="feature-badge">Ollama API</span>
</h2>
<div class="setting-item">
<div>
<div class="font-medium">Enable Advanced Parameters</div>
<div class="text-sm text-muted-foreground">Fine-tune model behavior with advanced options</div>
</div>
<div class="toggle-switch" id="advancedParamsToggle"></div>
</div>
<div id="advancedParamsSection" class="mt-4 space-y-4" style="display: none;">
<div class="grid grid-cols-2 gap-4">
<div>
<label class="text-sm font-medium">Temperature</label>
<div class="text-xs text-muted-foreground mb-1">Creativity (0.0 = focused, 1.0 = creative)</div>
<input type="range" id="temperatureSlider" min="0" max="2" step="0.1" value="0.8" class="w-full">
<div class="text-xs text-center mt-1" id="temperatureValue">0.8</div>
</div>
<div>
<label class="text-sm font-medium">Top P</label>
<div class="text-xs text-muted-foreground mb-1">Nucleus sampling (0.1 = focused, 1.0 = diverse)</div>
<input type="range" id="topPSlider" min="0.1" max="1" step="0.05" value="0.9" class="w-full">
<div class="text-xs text-center mt-1" id="topPValue">0.9</div>
</div>
<div>
<label class="text-sm font-medium">Top K</label>
<div class="text-xs text-muted-foreground mb-1">Consider top K tokens</div>
<input type="range" id="topKSlider" min="1" max="100" step="1" value="20" class="w-full">
<div class="text-xs text-center mt-1" id="topKValue">20</div>
</div>
<div>
<label class="text-sm font-medium">Repeat Penalty</label>
<div class="text-xs text-muted-foreground mb-1">Avoid repetition (1.0 = none, 1.2 = moderate)</div>
<input type="range" id="repeatPenaltySlider" min="1" max="2" step="0.05" value="1.1" class="w-full">
<div class="text-xs text-center mt-1" id="repeatPenaltyValue">1.1</div>
</div>
</div>
<div>
<label class="text-sm font-medium">Seed (Optional)</label>
<div class="text-xs text-muted-foreground mb-1">Fixed seed for reproducible outputs</div>
<input type="number" id="seedInput" placeholder="Leave empty for random" class="bg-input border border-border rounded-md px-3 py-2 text-sm w-full">
</div>
</div>
</div>
<!-- Structured Outputs -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
📋 Structured Outputs
<span class="feature-badge">JSON Mode</span>
</h2>
<div class="setting-item">
<div>
<div class="font-medium">Enable Structured Outputs</div>
<div class="text-sm text-muted-foreground">Force responses to follow JSON format or schema</div>
</div>
<div class="toggle-switch" id="structuredOutputToggle"></div>
</div>
<div id="structuredOutputSection" class="mt-4" style="display: none;">
<div class="setting-item">
<div>
<div class="font-medium">Output Format</div>
<div class="text-sm text-muted-foreground">Choose response format</div>
</div>
<select id="outputFormatSelect" class="bg-input border border-border rounded-md px-3 py-2 text-sm">
<option value="auto">Auto (Normal)</option>
<option value="json">JSON Mode</option>
<option value="schema">Custom Schema</option>
</select>
</div>
<div id="jsonSchemaSection" class="pt-4" style="display: none;">
<label class="text-sm font-medium">JSON Schema</label>
<div class="text-xs text-muted-foreground mb-2">Define the structure for responses</div>
<textarea id="jsonSchemaInput" class="bg-input border border-border rounded-md px-3 py-2 text-sm w-full h-32 resize-y font-mono" placeholder='{"type": "object", "properties": {"name": {"type": "string"}}}'></textarea>
</div>
</div>
</div>
<!-- Web Search Configuration -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4">🔍 Web Search Configuration</h2>
<div class="setting-item">
<div>
<div class="font-medium">Search Engine</div>
<div class="text-sm text-muted-foreground">Choose your preferred search provider</div>
</div>
<select id="searchEngine" class="bg-input border border-border rounded-md px-3 py-2 text-sm">
<option value="serper">Serper.dev (Google Results)</option>
<option value="duckduckgo">DuckDuckGo (Free)</option>
</select>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Serper API Key</div>
<div class="text-sm text-muted-foreground">Your Serper.dev API key for Google search results. <a href="https://serper.dev" target="_blank" class="text-blue-400 hover:underline">Get one free</a><br>
<span class="text-xs">Optional - Falls back to shared key if empty</span></div>
</div>
<input type="password" id="serperApiKey" class="bg-input border border-border rounded-md px-3 py-2 text-sm w-48" placeholder="Your API key (optional)" value="d03c7ebd4196bf9562d419973ae064">
</div>
<div class="setting-item">
<div>
<div class="font-medium">Max Search Results</div>
<div class="text-sm text-muted-foreground">Number of results to return</div>
</div>
<select id="maxResults" class="bg-input border border-border rounded-md px-3 py-2 text-sm">
<option value="3">3</option>
<option value="5" selected>5</option>
<option value="10">10</option>
</select>
</div>
</div>
<!-- Privacy & Data -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4">🔒 Privacy & Data</h2>
<div class="setting-item">
<div>
<div class="font-medium">Auto Page Context</div>
<div class="text-sm text-muted-foreground">Automatically extract page context when opening</div>
</div>
<div class="toggle-switch" id="autoContextToggle"></div>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Save Chat History</div>
<div class="text-sm text-muted-foreground">Store conversations locally</div>
</div>
<div class="toggle-switch active" id="saveHistoryToggle"></div>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Screenshot Quality</div>
<div class="text-sm text-muted-foreground">Quality for image captures</div>
</div>
<select id="screenshotQuality" class="bg-input border border-border rounded-md px-3 py-2 text-sm">
<option value="60">Low (60%)</option>
<option value="80">Medium (80%)</option>
<option value="90" selected>High (90%)</option>
<option value="100">Maximum (100%)</option>
</select>
</div>
</div>
<!-- Keyboard Shortcuts -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4">⌨️ Keyboard Shortcuts</h2>
<div class="space-y-3">
<div class="flex justify-between items-center text-sm">
<span>Open SideLlama</span>
<kbd class="px-2 py-1 bg-muted rounded text-xs">Ctrl+Shift+O</kbd>
</div>
<div class="flex justify-between items-center text-sm">
<span>Summarize Page</span>
<kbd class="px-2 py-1 bg-muted rounded text-xs">Ctrl+Shift+S</kbd>
</div>
<div class="flex justify-between items-center text-sm">
<span>Explain Selection</span>
<kbd class="px-2 py-1 bg-muted rounded text-xs">Ctrl+Shift+E</kbd>
</div>
</div>
</div>
<!-- Model Management -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
🏃 Running Models
<span class="feature-badge">Live Status</span>
</h2>
<div class="setting-item">
<div>
<div class="font-medium">Auto-refresh Running Models</div>
<div class="text-sm text-muted-foreground">Monitor active models in real-time</div>
</div>
<div class="toggle-switch" id="autoRefreshModelsToggle"></div>
</div>
<div class="mt-4">
<div class="flex justify-between items-center mb-3">
<div class="text-sm font-medium">Currently Running:</div>
<button id="refreshRunningModels" class="text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded hover:opacity-80">
🔄 Refresh
</button>
</div>
<div id="runningModelsList" class="space-y-2 min-h-[60px] max-h-40 overflow-y-auto">
<div class="text-sm text-muted-foreground text-center py-4">
Click refresh to check running models
</div>
</div>
</div>
</div>
<!-- Performance Monitoring -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
📊 Performance Monitoring
<span class="feature-badge">Analytics</span>
</h2>
<div class="setting-item">
<div>
<div class="font-medium">Show Performance Stats</div>
<div class="text-sm text-muted-foreground">Display tokens/sec, response time, and throughput</div>
</div>
<div class="toggle-switch" id="performanceStatsToggle"></div>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Keep-Alive Duration</div>
<div class="text-sm text-muted-foreground">How long to keep models loaded in memory</div>
</div>
<select id="keepAliveSelect" class="bg-input border border-border rounded-md px-3 py-2 text-sm">
<option value="5m">5 minutes</option>
<option value="10m">10 minutes</option>
<option value="30m">30 minutes</option>
<option value="1h">1 hour</option>
<option value="-1">Keep indefinitely</option>
</select>
</div>
<div class="setting-item">
<div>
<div class="font-medium">Show Thinking Process</div>
<div class="text-sm text-muted-foreground">Display AI reasoning in collapsible sections</div>
</div>
<div class="toggle-switch active" id="showThinkingToggle"></div>
</div>
</div>
<!-- About -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4">ℹ️ About SideLlama</h2>
<div class="space-y-3 text-sm">
<div class="flex justify-between">
<span>Version</span>
<span>2.0.0</span>
</div>
<div class="flex justify-between">
<span>Ollama Integration</span>
<span class="text-green-400">Latest 2024 Features</span>
</div>
<div class="flex justify-between">
<span>Tool Calling Support</span>
<span class="text-green-400">Streaming & Function Calls</span>
</div>
<div class="flex justify-between">
<span>Vision Capabilities</span>
<span class="text-green-400">Screenshot Analysis</span>
</div>
</div>
</div>
<!-- Debug Section -->
<div class="setting-card">
<h2 class="text-lg font-semibold mb-4">🔧 Debug Settings</h2>
<div class="setting-item">
<div>
<div class="font-medium">Show Current Settings</div>
<div class="text-sm text-muted-foreground">Display all settings in console for debugging</div>
</div>
<button id="debugSettingsBtn" class="text-xs bg-secondary text-secondary-foreground px-3 py-1 rounded hover:opacity-80">
🐛 Debug
</button>
</div>
</div>
<!-- Save Button -->
<div class="flex justify-end mt-6">
<button id="saveSettings" class="bg-primary text-primary-foreground px-6 py-2 rounded-md font-medium hover:opacity-90 transition-opacity">
Save Settings
</button>
</div>
</div>
</div>
<script src="shared-utils.js"></script>
<script src="settings.js"></script>
</body>
</html>