-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.html
More file actions
407 lines (364 loc) · 11.8 KB
/
options.html
File metadata and controls
407 lines (364 loc) · 11.8 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TL;DR Settings</title>
<style>
:root {
/* Base colors */
--primary-color: #2563eb;
--primary-hover: #1d4ed8;
--bg-color: #f8fafc;
--input-bg: #ffffff;
--text-color: #1e293b;
--border-color: #e2e8f0;
/* Advanced settings colors */
--group-bg: #f1f5f9;
--group-border: #e2e8f0;
--group-title: #475569;
--range-text: #64748b;
--reset-hover: #e2e8f0;
}
/* Advanced Settings Styles */
.advanced-settings {
margin-top: 1rem;
border: 1px solid var(--border-color);
border-radius: 8px;
overflow: hidden;
}
.advanced-settings summary {
padding: 0.5rem 0.75rem;
cursor: pointer;
user-select: none;
background: var(--bg-color);
border-bottom: 1px solid var(--border-color);
transition: background-color 0.2s ease;
list-style: none;
}
.advanced-settings summary:hover {
background: var(--group-bg);
}
.advanced-settings summary::-webkit-details-marker,
.advanced-settings summary::marker {
display: none;
}
.summary-content {
display: flex;
align-items: center;
gap: 0.5rem;
font-weight: 500;
color: var(--text-color);
}
.chevron-icon {
transition: transform 0.3s ease;
fill: currentColor;
}
.advanced-settings[open] .chevron-icon {
transform: rotate(90deg);
}
.advanced-content {
padding: 0.75rem;
background: var(--input-bg);
}
.settings-group {
padding: 0.75rem;
background: var(--group-bg);
border-radius: 6px;
margin-bottom: 0.75rem;
}
.settings-group:last-child {
margin-bottom: 0;
}
.settings-group h3 {
font-size: 0.875rem;
color: var(--group-title);
margin: 0 0 0.5rem 0;
font-weight: 600;
}
.input-range {
font-size: 0.75rem;
color: var(--range-text);
margin-top: 0.25rem;
}
.reset-button {
background: none;
border: none;
cursor: pointer;
padding: 0.25rem;
margin-left: 0.5rem;
border-radius: 4px;
color: var(--text-color);
opacity: 0.6;
transition: all 0.2s ease;
}
.reset-button:hover {
opacity: 1;
background: var(--reset-hover);
}
/* Tooltip styles */
.tooltip-wrapper {
position: relative;
width: 100%;
}
.tooltip {
display: none;
position: absolute;
top: -4px;
left: 0;
transform: translateY(-100%);
background: var(--text-color);
color: white;
padding: 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
width: 100%;
max-width: 250px;
z-index: 1000;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.tooltip-wrapper:hover .tooltip {
display: block;
}
body {
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
margin: 0;
padding: 2rem;
background: var(--bg-color);
color: var(--text-color);
line-height: 1.5;
}
h1 {
font-size: 1.875rem;
font-weight: 600;
margin-bottom: 2rem;
color: var(--text-color);
}
.container {
max-width: 500px;
margin: 0 auto;
padding: 2rem;
background: var(--input-bg);
border-radius: 12px;
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
form {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.form-group {
display: flex;
flex-direction: column;
gap: 0.25rem;
margin-bottom: 0.5rem;
}
.form-group:last-child {
margin-bottom: 0;
}
.form-group input {
margin-bottom: 0.125rem;
}
.input-range {
font-size: 0.75rem;
color: var(--range-text);
margin-top: 0.125rem;
margin-bottom: 0.25rem;
opacity: 0.8;
}
input, textarea, select {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid var(--border-color);
border-radius: 6px;
background: var(--input-bg);
color: var(--text-color);
font-size: 0.875rem;
transition: all 0.2s ease;
box-sizing: border-box;
}
input:focus, textarea:focus, select:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.api-key-container {
position: relative;
}
.toggle-visibility {
position: absolute;
right: 1rem;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
cursor: pointer;
padding: 0;
font-size: 1.25rem;
color: var(--text-color);
opacity: 0.7;
transition: opacity 0.2s ease;
}
.toggle-visibility:hover {
opacity: 1;
}
button[type="submit"] {
background: var(--primary-color);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 6px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
margin-top: 1rem;
}
button[type="submit"]:hover {
background: var(--primary-hover);
transform: translateY(-1px);
}
.success-message {
position: fixed;
top: 1rem;
right: 1rem;
background: #10b981;
color: white;
padding: 1rem 1.5rem;
border-radius: 6px;
font-weight: 500;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
transform: translateX(120%);
transition: transform 0.3s ease;
}
.success-message.show {
transform: translateX(0);
}
</style>
</head>
<body>
<div class="container">
<h1>TL;DR Settings</h1>
<form id="options-form">
<div class="form-group">
<label for="baseUrl">Base URL</label>
<input type="text" id="baseUrl" placeholder="https://api.openai.com/v1">
</div>
<div class="form-group">
<label for="apiKey">API Key</label>
<div class="api-key-container">
<input type="password" id="apiKey" placeholder="Enter your API key">
<button type="button" class="toggle-visibility" title="Toggle visibility">👁️</button>
</div>
</div>
<div class="form-group">
<label for="model">Model</label>
<input type="text" id="model" placeholder="o3-mini">
</div>
<div class="form-group">
<label for="prompt">System prompt</label>
<textarea id="prompt" rows="3" placeholder="Summarize this text in 3 key points. Format each point as a proper Markdown."></textarea>
</div>
<details class="advanced-settings">
<summary>
<span class="summary-content">
<svg class="chevron-icon" viewBox="0 0 24 24" width="16" height="16">
<path d="M9.293 6.293a1 1 0 011.414 0L15 10.586l-4.293 4.293a1 1 0 01-1.414-1.414L12.172 11 9.293 8.121a1 1 0 010-1.414z"/>
</svg>
Advanced Settings
</span>
</summary>
<div class="advanced-content">
<div class="settings-group">
<h3>Generation Parameters</h3>
<div class="form-group">
<div class="tooltip-wrapper">
<label for="temperature">
Temperature
<button type="button" class="reset-button" data-default="0.8" title="Reset to default (0.8)">↺</button>
</label>
<div class="tooltip">Controls randomness in the output. Higher values make the output more random, lower values make it more focused and deterministic.</div>
</div>
<input type="number" id="temperature" value="0.8" step="0.1" min="0" max="2.0">
<span class="input-range">Range: 0 to 2.0</span>
</div>
<div class="form-group">
<div class="tooltip-wrapper">
<label for="top_p">
Top p
<button type="button" class="reset-button" data-default="1.0" title="Reset to default (1.0)">↺</button>
</label>
<div class="tooltip">Controls diversity via nucleus sampling. Lower values mean less diversity.</div>
</div>
<input type="number" id="top_p" value="1.0" step="0.1" min="0" max="1.0">
<span class="input-range">Range: 0 to 1.0</span>
</div>
<div class="form-group">
<div class="tooltip-wrapper">
<label for="top_k">
Top k
<button type="button" class="reset-button" data-default="0" title="Reset to default (0)">↺</button>
</label>
<div class="tooltip">Limits the cumulative probability of tokens considered for sampling.</div>
</div>
<input type="number" id="top_k" value="0" step="1" min="0">
<span class="input-range">Range: 0 or above</span>
</div>
</div>
<div class="settings-group">
<h3>Penalty Controls</h3>
<div class="form-group">
<div class="tooltip-wrapper">
<label for="frequency_penalty">
Frequency Penalty
<button type="button" class="reset-button" data-default="0" title="Reset to default (0)">↺</button>
</label>
<div class="tooltip">Reduces repetition by penalizing tokens based on their frequency in the text.</div>
</div>
<input type="number" id="frequency_penalty" value="0" step="0.1" min="-2.0" max="2.0">
<span class="input-range">Range: -2.0 to 2.0</span>
</div>
<div class="form-group">
<div class="tooltip-wrapper">
<label for="presence_penalty">
Presence Penalty
<button type="button" class="reset-button" data-default="0" title="Reset to default (0)">↺</button>
</label>
<div class="tooltip">Encourages the model to talk about new topics by penalizing tokens that have appeared in the text.</div>
</div>
<input type="number" id="presence_penalty" value="0" step="0.1" min="-2.0" max="2.0">
<span class="input-range">Range: -2.0 to 2.0</span>
</div>
<div class="form-group">
<div class="tooltip-wrapper">
<label for="repetition_penalty">
Repetition Penalty
<button type="button" class="reset-button" data-default="0" title="Reset to default (0)">↺</button>
</label>
<div class="tooltip">Penalizes repetition of tokens that have already appeared in the generated text.</div>
</div>
<input type="number" id="repetition_penalty" value="0" step="0.1" min="-2.0" max="2.0">
<span class="input-range">Range: -2.0 to 2.0</span>
</div>
</div>
<div class="settings-group">
<h3>Length Control</h3>
<div class="form-group">
<div class="tooltip-wrapper">
<label for="max_tokens">
Max Tokens
<button type="button" class="reset-button" data-default="" title="Reset to default (no limit)">↺</button>
</label>
<div class="tooltip">Maximum number of tokens to generate. Leave empty for no limit.</div>
</div>
<input type="number" id="max_tokens" placeholder="No limit" min="1">
<span class="input-range">Range: 1 or above (optional)</span>
</div>
</div>
</div>
</details>
<button type="submit">Save settings</button>
</form>
</div>
<div class="success-message" id="success-message">Settings saved successfully!</div>
<script src="options.js"></script>
</body>
</html>