Repository navigation
Expand file tree
/
Copy pathoptions.html
More file actions
309 lines (293 loc) · 18.7 KB
/
Copy pathoptions.html
File metadata and controls
309 lines (293 loc) · 18.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AutoSort+ Settings</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>AutoSort+ Settings</h1>
<div class="section collapsible-section">
<div class="section-header" data-section="ai-settings">
<h2>🤖 AI Settings</h2>
<span class="collapse-icon">▼</span>
</div>
<div class="section-content" id="ai-settings">
<div class="subsection">
<h3>Provider Selection</h3>
<div class="input-group">
<label for="ai-provider">AI Provider:</label>
<select id="ai-provider" class="provider-select">
<option value="gemini">Google Gemini (Recommended)</option>
<option value="openai">OpenAI (ChatGPT)</option>
<option value="anthropic">Anthropic Claude</option>
<option value="groq">Groq (Fast & Free)</option>
<option value="mistral">Mistral AI</option>
<option value="ollama">Ollama (Local LLM)</option>
<option value="lmstudio">LM Studio (Local LLM)</option>
</select>
</div>
<div id="provider-info" class="provider-info"></div>
<div id="rate-limit-warning" class="warning-box" style="display: none;">
<strong>⚠️ Rate Limit Warning:</strong> Free API tiers are severely limited when processing emails. You may only process 5-20 emails before hitting rate limits. Paid plans ($5-20/month) are recommended for daily email processing.
</div>
</div>
<div class="subsection" id="ollama-settings-subsection" style="display: none;">
<h3>🏠 Local Ollama Configuration</h3>
<label for="ollama-url">Ollama Server URL:</label>
<input type="text" id="ollama-url" class="api-key-input" placeholder="http://localhost:11434" value="http://localhost:11434">
<div class="checkbox-container">
<input type="checkbox" id="ollama-cpu-only">
<label for="ollama-cpu-only">Force CPU-only mode (disable GPU acceleration)</label>
</div>
<label for="ollama-model">Ollama Model:</label>
<select id="ollama-model" class="provider-select">
<option value="llama2">Llama 2</option>
<option value="llama3.2">Llama 3.2</option>
<option value="mistral">Mistral</option>
<option value="phi">Phi</option>
<option value="gemma">Gemma</option>
<option value="qwen2.5">Qwen 2.5</option>
<option value="custom">Custom (enter below)</option>
</select>
<div class="input-group">
<label for="ollama-auth-token">Ollama Auth Token (optional):</label>
<input type="password" id="ollama-auth-token" class="api-key-input" placeholder="If your Ollama server requires a token, enter it here">
<small class="help-text">Used for /api/chat and /api/pull requests when required.</small>
</div>
<input type="text" id="ollama-custom-model" class="api-key-input" placeholder="Enter custom model name" style="display: none; margin-top: 10px;">
<div class="input-group">
<label for="ollama-download-model">Download Model:</label>
<input type="text" id="ollama-download-model" class="api-key-input" placeholder="e.g., llama3.2, mistral, qwen2.5:7b">
</div>
<div class="button-group">
<button id="download-ollama-model" class="button">Download</button>
<button id="list-ollama-models" class="button">List Installed Models</button>
<button id="test-ollama" class="button">Test Connection</button>
<button id="diagnose-ollama" class="button">Run Diagnostics</button>
</div>
<div id="ollama-download-status" class="api-test-result" style="display: none;"></div>
<div id="ollama-test-result" class="api-test-result"></div>
<div id="ollama-diagnostics" class="diagnostics-result" style="display: none;"></div>
</div>
<div class="subsection" id="lmstudio-settings-subsection" style="display: none;">
<h3>🖥️ Local LM Studio Configuration</h3>
<label for="lmstudio-url">LM Studio Server URL:</label>
<input type="text" id="lmstudio-url" class="api-key-input" placeholder="http://localhost:1234" value="http://localhost:1234">
<small class="help-text">Start the server in LM Studio: open <strong>Settings → Local Model API</strong> and toggle the top option on (default port 1234). LM Studio shows the base URL as <code>http://localhost:1234/v1</code> — you can paste that here or just <code>http://localhost:1234</code>; the <code>/v1</code> suffix is stripped automatically.</small>
<div class="input-group">
<label for="lmstudio-model">LM Studio Model:</label>
<div class="model-select-wrapper">
<select id="lmstudio-model" class="provider-select model-select" aria-label="LM Studio model">
<option value="">Click "List Models" to load…</option>
</select>
</div>
<input type="text" id="lmstudio-custom-model" class="api-key-input" placeholder="e.g. qwen2.5-7b-instruct" style="display: none; margin-top: 10px;">
</div>
<div class="input-group">
<label for="lmstudio-auth-token">LM Studio API Token (optional):</label>
<input type="password" id="lmstudio-auth-token" class="api-key-input" placeholder="Only if you enabled authentication in LM Studio">
<small class="help-text">Leave blank unless you turned on <strong>Require Authentication</strong> in LM Studio's <strong>Server Settings</strong> and created a token via <strong>Manage Tokens</strong> (LM Studio 0.4.0+). Sent as a Bearer token for /api/v1/chat and /api/v1/models.</small>
</div>
<div class="button-group">
<button id="list-lmstudio-models" class="button">List Models</button>
<button id="test-lmstudio" class="button">Test Connection</button>
</div>
<div id="lmstudio-test-result" class="api-test-result"></div>
</div>
<div class="subsection" id="api-key-subsection">
<h3>🔑 API Key Configuration</h3>
<div class="input-group">
<label for="api-key" id="api-key-label">API Key:</label>
<input type="password" id="api-key" class="api-key-input" placeholder="Enter your API key">
<div class="button-group">
<button id="test-api" class="button">Test API Connection</button>
<button id="get-api-key" class="button button-link">Get API Key</button>
</div>
<div id="api-test-result" class="api-test-result"></div>
</div>
<div class="input-group">
<label for="provider-model">Model (optional):</label>
<input type="text" id="provider-model" class="api-key-input" placeholder="Leave blank to use the default model">
<small class="help-text" id="provider-model-help"></small>
</div>
</div>
</div>
<div class="subsection" id="gemini-multi-keys-subsection" style="display: none;">
<h3>🔄 Multiple Gemini API Keys</h3>
<p class="info-text">Add multiple API keys from different Google Cloud projects. The extension will automatically rotate between them when rate limits are reached.</p>
<div class="input-group">
<label for="bulk-import-gemini-keys-text" class="help-text">Bulk Import:</label>
<textarea id="bulk-import-gemini-keys-text" rows="3" placeholder="Enter one API key per line"></textarea>
</div>
<div class="button-group">
<button id="bulk-import-keys-button" class="button">Import Keys</button>
<button id="add-gemini-key" class="button">+ Add Another Gemini Key</button>
<button id="test-all-gemini-keys" class="button">Test All Keys</button>
</div>
<small class="help-text">Testing sends one API request per key and may count toward each key's quota.</small>
<div id="gemini-keys-list" class="gemini-keys-list"></div>
</div>
<div class="subsection" id="gemini-model-subsection" style="display: none;">
<h3>🧠 Gemini Model</h3>
<p class="info-text">Choose which Gemini model to use. <strong>New</strong> Google AI Studio API keys can no longer access the 2.5 models (they return a 404 "no longer available to new users"), so pick a current model such as <code>gemini-3.5-flash-lite</code>.</p>
<div class="input-group">
<label for="gemini-model">Model:</label>
<div class="model-select-wrapper">
<select id="gemini-model" class="provider-select model-select" aria-label="Gemini model">
<option value="gemini-3.5-flash-lite">Gemini 3.5 Flash-Lite — recommended (fast & cheap)</option>
<option value="gemini-3.8-flash">Gemini 3.8 Flash — latest, most capable</option>
<option value="gemini-3.7-flash">Gemini 3.7 Flash</option>
<option value="gemini-3.6-flash">Gemini 3.6 Flash</option>
<option value="gemini-3.1-flash-lite">Gemini 3.1 Flash-Lite</option>
<option value="gemini-2.5-flash">Gemini 2.5 Flash — existing users only</option>
<option value="gemini-2.5-flash-lite">Gemini 2.5 Flash-Lite — existing users only</option>
<option value="__custom__">Custom model… (type your own)</option>
</select>
</div>
<input type="text" id="gemini-model-custom" class="api-key-input" placeholder="e.g. gemini-3.8-pro" style="display: none;">
<div class="button-group">
<button id="load-gemini-models" class="button">Load Available Models</button>
</div>
<small class="help-text">Pick a model from the dropdown. Or click "Load Available Models" to fetch the models your API key can actually use.</small>
</div>
<div id="gemini-model-status" class="api-test-result"></div>
</div>
<div class="subsection" id="ai-general-subsection">
<h3>⚙️ General Settings</h3>
<input type="checkbox" id="enable-ai" checked>
<label for="enable-ai">Enable AI-powered sorting</label>
<div class="checkbox-container">
<input type="checkbox" id="completion-sound-enabled">
<label for="completion-sound-enabled">Play a sound when batch sorting finishes</label>
</div>
<div class="input-group">
<label for="batch-chunk-size">Parallel batch size:</label>
<input type="number" id="batch-chunk-size" class="api-key-input" min="1" max="20" step="1" value="5">
<small class="help-text">How many emails to analyze at once during a batch (1–20). Default 5. Higher is faster but fires more API requests at the same time.</small>
</div>
</div>
<div class="checkbox-container" id="gemini-paid-container" style="display: none;">
<input type="checkbox" id="gemini-paid-plan">
<label for="gemini-paid-plan">I have a Gemini paid plan (removes rate limits)</label>
</div>
</div>
<div class="subsection" id="gemini-usage-subsection" style="display: none;">
<h3>📊 Gemini API Usage</h3>
<small class="help-text">Usage automatically refreshes every 10 seconds.</small>
<div class="checkbox-container">
<input type="checkbox" id="gemini-reset-notifications">
<label for="gemini-reset-notifications">Notify me when a used key's daily counter resets</label>
</div>
<div id="single-key-usage" style="display: none;">
<div class="usage-stats">
<div class="usage-item">
<strong>Today's Usage:</strong> <span id="gemini-daily-count">0</span>/20 requests
</div>
<div class="usage-item">
<strong>Last Request:</strong> <span id="gemini-last-request">Never</span>
</div>
<div class="usage-item">
<strong>Daily Limit Resets:</strong> <span id="gemini-reset-time">--</span>
</div>
<div class="usage-item">
<strong>Status:</strong> <span id="gemini-status">Ready</span>
</div>
</div>
<div class="button-group">
<button id="reset-gemini-counter" class="button">Reset Counter (New API Key)</button>
<button id="refresh-usage" class="button">Refresh Usage</button>
</div>
<div id="usage-message" class="usage-message"></div>
</div>
<div id="multi-key-usage" style="display: none;">
<div id="all-keys-usage-stats" class="all-keys-usage"></div>
<div class="button-group">
<button id="refresh-all-usage" class="button">Refresh All Usage</button>
</div>
</div>
</div>
</div>
<div class="subsection ai-info-subsection">
<h3>ℹ️ How AI Sorting Works</h3>
<div class="ai-description">
<p>AutoSort+ uses AI to analyze your emails and automatically sort them into categories/folders based on their content. The AI will:</p>
<ul>
<li>Read and understand email content</li>
<li>Identify key topics and themes</li>
<li>Match emails to appropriate categories/folders</li>
<li>Learn from your manual corrections to improve accuracy</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="section collapsible-section">
<div class="section-header" data-section="folders-settings">
<h2>📁 Custom Categories/Folders</h2>
<span class="collapse-icon">▼</span>
</div>
<div class="section-content" id="folders-settings">
<div class="folder-source">
<h3>Folder Source</h3>
<button id="load-imap-folders" class="button">Load Folders from Mail Account</button>
<div id="folder-loading" class="loading-indicator" style="display: none;">Loading folders...</div>
<div id="folder-selection" class="folder-selection" style="display: none;">
<p>Found <span id="folder-count">0</span> folders in your mail account. Would you like to use these?</p>
<div id="folders-preview" class="folders-preview"></div>
<div class="button-group">
<button id="use-imap-folders" class="button primary">Use These Folders</button>
<button id="use-custom-folders" class="button">Use Custom Folders Instead</button>
</div>
</div>
</div>
<div class="bulk-import">
<label for="bulk-import-labels-text">Import Categories/Folders (one per line):</label>
<textarea id="bulk-import-labels-text" class="bulk-import-textarea" placeholder="Enter categories/folders, one per line"></textarea>
<button id="import-labels" class="button">Import</button>
</div>
<div id="labels-container">
<div class="label-item">
<input type="text" class="label-input" placeholder="Enter category/folder name">
<button class="remove-label">×</button>
</div>
</div>
<button id="add-label" class="button">Add</button>
</div>
</div>
<div class="section collapsible-section collapsed">
<div class="section-header" data-section="history-settings">
<h2>📜 Move History</h2>
<span class="collapse-icon">▶</span>
</div>
<div class="section-content" id="history-settings" style="display: none;">
<div class="history-controls">
<button id="clear-history" class="button">Clear History</button>
<button id="refresh-history" class="button">Refresh</button>
</div>
<div class="history-container">
<table id="history-table">
<thead>
<tr>
<th>Timestamp</th>
<th>Subject</th>
<th>Status</th>
<th>Destination</th>
</tr>
</thead>
<tbody id="history-body">
<!-- History entries will be added here -->
</tbody>
</table>
</div>
</div>
</div>
<div class="section save-section">
<button id="save-settings" class="button primary">Save Settings</button>
</div>
</div>
<script src="options.js"></script>
</body>
</html>