@pheem49/mint 1.7.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/Cargo.lock +3 -3
  2. package/Cargo.toml +1 -1
  3. package/README.md +9 -0
  4. package/crates/mint-core/src/api_server.rs +62 -4
  5. package/crates/mint-core/src/chat.rs +79 -0
  6. package/crates/mint-core/src/lib.rs +1 -1
  7. package/crates/mint-core/src/workflows.rs +8 -0
  8. package/package.json +2 -1
  9. package/src/renderer/src/App.tsx +1 -1
  10. package/src/renderer/src/components/ChatPanel.tsx +27 -14
  11. package/src/renderer/src/components/DashboardSidebar.tsx +71 -12
  12. package/src/renderer/src/components/ImageStudioPanel.tsx +7 -3
  13. package/src/renderer/src/components/MintDashboard.tsx +199 -5
  14. package/src/renderer/src/components/PicturesLibrary.tsx +1 -3
  15. package/src/renderer/src/components/Settings/AudioTab.tsx +97 -0
  16. package/src/renderer/src/components/Settings/AutomationTab.tsx +195 -0
  17. package/src/renderer/src/components/Settings/GeneralTab.tsx +950 -0
  18. package/src/renderer/src/components/Settings/MemoryTab.tsx +60 -0
  19. package/src/renderer/src/components/Settings/PluginsTab.tsx +452 -0
  20. package/src/renderer/src/components/Settings/ShortcutsTab.tsx +30 -0
  21. package/src/renderer/src/components/Settings/ThemeTab.tsx +129 -0
  22. package/src/renderer/src/components/SettingsWindow.tsx +175 -962
  23. package/src/renderer/src/components/WorkflowBuilderPanel.tsx +536 -0
  24. package/src/renderer/src/components/WorkflowsWindow.tsx +46 -0
  25. package/src/renderer/src/css/image-studio.css +9 -4
  26. package/src/renderer/src/css/settings.css +75 -6
  27. package/src/renderer/src/css/styles.css +355 -38
  28. package/src/renderer/src/css/workflows.css +542 -0
  29. package/src/renderer/src/env.d.ts +2 -0
  30. package/src/renderer/src/index.css +1 -0
  31. package/src/renderer/src/tauri.ts +97 -0
  32. package/src/renderer/src-web/components/ChatPanel.tsx +27 -14
  33. package/src/renderer/src-web/components/DashboardSidebar.tsx +17 -1
  34. package/src/renderer/src-web/components/ImageStudioPanel.tsx +7 -3
  35. package/src/renderer/src-web/components/MintDashboard.tsx +189 -0
  36. package/src/renderer/src-web/components/PicturesLibrary.tsx +1 -3
  37. package/src/renderer/src-web/components/Settings/AudioTab.tsx +97 -0
  38. package/src/renderer/src-web/components/Settings/AutomationTab.tsx +196 -0
  39. package/src/renderer/src-web/components/Settings/GeneralTab.tsx +948 -0
  40. package/src/renderer/src-web/components/Settings/MemoryTab.tsx +60 -0
  41. package/src/renderer/src-web/components/Settings/PluginsTab.tsx +452 -0
  42. package/src/renderer/src-web/components/Settings/ShortcutsTab.tsx +30 -0
  43. package/src/renderer/src-web/components/Settings/ThemeTab.tsx +129 -0
  44. package/src/renderer/src-web/components/SettingsWindow.tsx +187 -968
  45. package/src/renderer/src-web/css/image-studio.css +9 -4
  46. package/src/renderer/src-web/css/settings.css +75 -6
  47. package/src/renderer/src-web/css/styles.css +294 -38
  48. package/src/renderer/src-web/env.d.ts +2 -0
  49. package/src/renderer/src-web/tauri.ts +36 -0
  50. package/src-tauri/src/lib.rs +83 -90
  51. package/src-tauri/tauri.conf.json +1 -1
@@ -1,7 +1,13 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { getProfileValue, setProfileValue } from '../tauri'
3
-
4
- const DEFAULT_CONFIG = {
3
+ import GeneralTab from './Settings/GeneralTab'
4
+ import MemoryTab from './Settings/MemoryTab'
5
+ import AudioTab from './Settings/AudioTab'
6
+ import AutomationTab from './Settings/AutomationTab'
7
+ import ThemeTab from './Settings/ThemeTab'
8
+ import PluginsTab from './Settings/PluginsTab'
9
+
10
+ export const DEFAULT_CONFIG = {
5
11
  theme: 'dark',
6
12
  accentColor: '#10b981',
7
13
  systemTextColor: '#f8fafc',
@@ -67,12 +73,30 @@ const DEFAULT_CONFIG = {
67
73
  whatsappPhoneNumberId: '',
68
74
  whatsappVerifyToken: '',
69
75
  whatsappAppSecret: '',
70
- enableWhatsappBridge: false
76
+ enableWhatsappBridge: false,
77
+ notionApiKey: '',
78
+ notionDatabaseId: '',
79
+ gmailClientId: '',
80
+ gmailClientSecret: '',
81
+ gmailRefreshToken: '',
82
+ googleCalendarClientId: '',
83
+ googleCalendarClientSecret: '',
84
+ googleCalendarRefreshToken: '',
85
+ // Search
86
+ searchProvider: 'brave' as 'brave' | 'google',
87
+ googleSearchApiKey: '',
88
+ googleSearchCx: '',
89
+ braveSearchApiKey: '',
90
+ // Image Generation
91
+ imageGenProvider: 'gemini' as 'gemini' | 'dalle' | 'stability' | 'ideogram' | 'replicate',
92
+ stabilityApiKey: '',
93
+ ideogramApiKey: '',
94
+ replicateApiKey: ''
71
95
  }
72
96
 
73
97
  type TabType = 'sect-general' | 'sect-audio' | 'sect-automation' | 'sect-theme' | 'sect-plugins' | 'sect-shortcuts' | 'sect-memory'
74
98
 
75
- const GEMINI_MODELS = [
99
+ export const GEMINI_MODELS = [
76
100
  'gemini-2.5-flash',
77
101
  'gemini-2.5-pro',
78
102
  'gemini-2.0-flash',
@@ -82,7 +106,7 @@ const GEMINI_MODELS = [
82
106
  'gemini-3.1-flash-lite-preview'
83
107
  ]
84
108
 
85
- const OPENAI_MODELS = [
109
+ export const OPENAI_MODELS = [
86
110
  'gpt-4o',
87
111
  'gpt-4o-mini',
88
112
  'o1',
@@ -92,7 +116,7 @@ const OPENAI_MODELS = [
92
116
  'gpt-4-turbo'
93
117
  ]
94
118
 
95
- const OPENROUTER_MODELS = [
119
+ export const OPENROUTER_MODELS = [
96
120
  'openai/gpt-4o-mini',
97
121
  'openai/gpt-4o',
98
122
  'anthropic/claude-3.5-sonnet',
@@ -102,21 +126,21 @@ const OPENROUTER_MODELS = [
102
126
  'mistralai/mistral-large'
103
127
  ]
104
128
 
105
- const DEEPSEEK_MODELS = [
129
+ export const DEEPSEEK_MODELS = [
106
130
  'deepseek-v4-flash',
107
131
  'deepseek-v4-pro',
108
132
  'deepseek-chat',
109
133
  'deepseek-reasoner'
110
134
  ]
111
135
 
112
- const ANTHROPIC_MODELS = [
136
+ export const ANTHROPIC_MODELS = [
113
137
  'claude-3-7-sonnet-latest',
114
138
  'claude-3-5-sonnet-latest',
115
139
  'claude-3-5-haiku-latest',
116
140
  'claude-3-opus-latest'
117
141
  ]
118
142
 
119
- const HF_MODELS = [
143
+ export const HF_MODELS = [
120
144
  'meta-llama/Llama-3.3-70B-Instruct',
121
145
  'meta-llama/Meta-Llama-3-8B-Instruct',
122
146
  'meta-llama/Llama-3.2-3B-Instruct',
@@ -126,14 +150,14 @@ const HF_MODELS = [
126
150
  'google/gemma-2-9b-it'
127
151
  ]
128
152
 
129
- const LOCAL_MODELS = [
153
+ export const LOCAL_MODELS = [
130
154
  'local-model',
131
155
  'Qwen/Qwen2.5-7B-Instruct-GGUF',
132
156
  'meta-llama/Llama-3.2-3B-Instruct-GGUF',
133
157
  'lmstudio-community/gemma-2-9b-it-GGUF'
134
158
  ]
135
159
 
136
- const OLLAMA_MODELS = [
160
+ export const OLLAMA_MODELS = [
137
161
  'llama3:latest',
138
162
  'llama3.1:latest',
139
163
  'llama3.2:latest',
@@ -143,8 +167,6 @@ const OLLAMA_MODELS = [
143
167
  'qwen2.5:latest'
144
168
  ]
145
169
 
146
-
147
-
148
170
  export default function SettingsWindow() {
149
171
  const [activeTab, setActiveTab] = useState<TabType>('sect-general')
150
172
  const [config, setConfig] = useState(DEFAULT_CONFIG)
@@ -162,6 +184,7 @@ export default function SettingsWindow() {
162
184
  const [customHF, setCustomHF] = useState('')
163
185
  const [customLocal, setCustomLocal] = useState('')
164
186
  const [customOllama, setCustomOllama] = useState('')
187
+ const [dynamicOllamaModels, setDynamicOllamaModels] = useState<string[]>(OLLAMA_MODELS)
165
188
 
166
189
  // New MCP Server Form state
167
190
  const [mcpName, setMcpName] = useState('')
@@ -171,57 +194,88 @@ export default function SettingsWindow() {
171
194
  const [updateMessage, setUpdateMessage] = useState('')
172
195
  const [updateAvailable, setUpdateAvailable] = useState(false)
173
196
 
174
-
175
-
176
197
  // Load settings on mount
177
198
  useEffect(() => {
178
199
  async function loadSettings() {
179
200
  try {
201
+ let loadedConfig: any = null
202
+ if (window.settingsApi) {
203
+ loadedConfig = await window.settingsApi.getSettings()
204
+ } else {
205
+ const saved = await getProfileValue('user-settings')
206
+ if (saved) {
207
+ loadedConfig = JSON.parse(saved)
208
+ }
209
+ }
210
+
211
+ if (loadedConfig) {
212
+ const merged = { ...DEFAULT_CONFIG, ...loadedConfig }
213
+ setConfig(merged)
214
+
215
+ // sync helper custom models
216
+ if (merged.geminiModel && !GEMINI_MODELS.includes(merged.geminiModel)) {
217
+ setCustomGemini(merged.geminiModel)
218
+ }
219
+ if (merged.openaiModel && !OPENAI_MODELS.includes(merged.openaiModel)) {
220
+ setCustomOpenAI(merged.openaiModel)
221
+ }
222
+ if (merged.openrouterModel && !OPENROUTER_MODELS.includes(merged.openrouterModel)) {
223
+ setCustomOpenRouter(merged.openrouterModel)
224
+ }
225
+ if (merged.deepseekModel && !DEEPSEEK_MODELS.includes(merged.deepseekModel)) {
226
+ setCustomDeepSeek(merged.deepseekModel)
227
+ }
228
+ if (merged.anthropicModel && !ANTHROPIC_MODELS.includes(merged.anthropicModel)) {
229
+ setCustomAnthropic(merged.anthropicModel)
230
+ }
231
+ if (merged.hfModel && !HF_MODELS.includes(merged.hfModel)) {
232
+ setCustomHF(merged.hfModel)
233
+ }
234
+ if (merged.localModelName && !LOCAL_MODELS.includes(merged.localModelName)) {
235
+ setCustomLocal(merged.localModelName)
236
+ }
237
+ if (merged.ollamaModel && !OLLAMA_MODELS.includes(merged.ollamaModel)) {
238
+ setCustomOllama(merged.ollamaModel)
239
+ }
240
+
241
+ applyThemeStyles(merged)
242
+ }
243
+
244
+ // load name & pref
180
245
  const nameVal = await getProfileValue('name')
246
+ if (nameVal) setUserName(nameVal)
181
247
  const prefVal = await getProfileValue('preferences')
182
- setUserName(nameVal || '')
183
- setUserPreferences(prefVal || '')
248
+ if (prefVal) setUserPreferences(prefVal)
184
249
  } catch (e) {
185
- console.error("Failed to load user profile memory:", e)
186
- }
187
-
188
- if (window.settingsApi) {
189
- const loaded = await window.settingsApi.getSettings()
190
- const merged = { ...DEFAULT_CONFIG, ...loaded }
191
- setConfig(merged)
192
-
193
- // Set custom text helpers
194
- if (!GEMINI_MODELS.includes(merged.geminiModel)) {
195
- setCustomGemini(merged.geminiModel)
196
- }
197
- if (!OPENAI_MODELS.includes(merged.openaiModel)) {
198
- setCustomOpenAI(merged.openaiModel)
199
- }
200
- if (!OPENROUTER_MODELS.includes(merged.openrouterModel)) {
201
- setCustomOpenRouter(merged.openrouterModel)
202
- }
203
- if (!DEEPSEEK_MODELS.includes(merged.deepseekModel)) {
204
- setCustomDeepSeek(merged.deepseekModel)
205
- }
206
- if (!ANTHROPIC_MODELS.includes(merged.anthropicModel)) {
207
- setCustomAnthropic(merged.anthropicModel)
208
- }
209
- if (!HF_MODELS.includes(merged.hfModel)) {
210
- setCustomHF(merged.hfModel)
211
- }
212
- if (!LOCAL_MODELS.includes(merged.localModelName)) {
213
- setCustomLocal(merged.localModelName)
214
- }
215
- if (!OLLAMA_MODELS.includes(merged.ollamaModel)) {
216
- setCustomOllama(merged.ollamaModel)
217
- }
218
-
219
- applyThemeStyles(merged)
250
+ console.error("Failed to load settings:", e)
220
251
  }
221
252
  }
222
253
  loadSettings()
223
254
  }, [])
224
255
 
256
+ useEffect(() => {
257
+ const fetchOllamaModels = async () => {
258
+ const host = config.ollamaHost || 'http://127.0.0.1:11434';
259
+ const cleanHost = host.replace(/\/$/, '');
260
+ try {
261
+ const res = await fetch(`${cleanHost}/api/tags`);
262
+ if (res.ok) {
263
+ const data = await res.json();
264
+ if (data && Array.isArray(data.models)) {
265
+ const names = data.models.map((m: any) => m.name);
266
+ setDynamicOllamaModels(names);
267
+ return;
268
+ }
269
+ }
270
+ } catch (err) {
271
+ console.warn("Failed to fetch local Ollama models:", err);
272
+ }
273
+ setDynamicOllamaModels(OLLAMA_MODELS);
274
+ };
275
+
276
+ fetchOllamaModels();
277
+ }, [config.ollamaHost]);
278
+
225
279
  const applyThemeStyles = (cfg: typeof DEFAULT_CONFIG) => {
226
280
  document.documentElement.setAttribute('data-theme', cfg.theme)
227
281
  document.documentElement.style.setProperty('--accent', cfg.accentColor)
@@ -382,7 +436,6 @@ export default function SettingsWindow() {
382
436
  }
383
437
  }
384
438
 
385
- // Split args nicely or pass as string array
386
439
  const argList = mcpArgs.split(/\s+/).filter(Boolean)
387
440
 
388
441
  const updatedMcp = {
@@ -399,7 +452,6 @@ export default function SettingsWindow() {
399
452
  mcpServers: updatedMcp
400
453
  })
401
454
 
402
- // Reset fields
403
455
  setMcpName('')
404
456
  setMcpCmd('')
405
457
  setMcpArgs('')
@@ -458,7 +510,7 @@ export default function SettingsWindow() {
458
510
  <div className="settings-container">
459
511
  <header className="settings-header drag-region">
460
512
  <div className="header-left">
461
- <span className="settings-icon" style={{ display: 'inline-flex', alignItems: 'center' }}>
513
+ <span className="settings-icon">
462
514
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
463
515
  <circle cx="12" cy="12" r="3"></circle>
464
516
  <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
@@ -471,7 +523,7 @@ export default function SettingsWindow() {
471
523
  </div>
472
524
  <button className="close-btn" onClick={handleClose} aria-label="Close">
473
525
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
474
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
526
+ stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
475
527
  <line x1="18" y1="6" x2="6" y2="18"></line>
476
528
  <line x1="6" y1="6" x2="18" y2="18"></line>
477
529
  </svg>
@@ -492,9 +544,7 @@ export default function SettingsWindow() {
492
544
  <button className={`tab-btn ${activeTab === 'sect-memory' ? 'active' : ''}`} onClick={() => setActiveTab('sect-memory')}>
493
545
  <span style={{ display: 'inline-flex', alignItems: 'center' }}>
494
546
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
495
- <path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z"></path>
496
- <path d="M12 6a3 3 0 1 0 0 6 3 3 0 0 0 0-6z"></path>
497
- <path d="M6 18a6 6 0 0 1 12 0"></path>
547
+ <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path>
498
548
  </svg>
499
549
  </span>
500
550
  <strong>Memory & Profile</strong>
@@ -511,7 +561,9 @@ export default function SettingsWindow() {
511
561
  <button className={`tab-btn ${activeTab === 'sect-automation' ? 'active' : ''}`} onClick={() => setActiveTab('sect-automation')}>
512
562
  <span style={{ display: 'inline-flex', alignItems: 'center' }}>
513
563
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
514
- <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon>
564
+ <rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
565
+ <line x1="8" y1="21" x2="16" y2="21"></line>
566
+ <line x1="12" y1="17" x2="12" y2="21"></line>
515
567
  </svg>
516
568
  </span>
517
569
  <strong>Automation</strong>
@@ -535,931 +587,92 @@ export default function SettingsWindow() {
535
587
  <button className={`tab-btn ${activeTab === 'sect-plugins' ? 'active' : ''}`} onClick={() => setActiveTab('sect-plugins')}>
536
588
  <span style={{ display: 'inline-flex', alignItems: 'center' }}>
537
589
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
538
- <path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
590
+ <polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
591
+ <polyline points="2 17 12 22 22 17"></polyline>
592
+ <polyline points="2 12 12 17 22 12"></polyline>
539
593
  </svg>
540
594
  </span>
541
595
  <strong>Plugins</strong>
542
596
  </button>
543
- <button className={`tab-btn ${activeTab === 'sect-shortcuts' ? 'active' : ''}`} onClick={() => setActiveTab('sect-shortcuts')}>
544
- <span style={{ display: 'inline-flex', alignItems: 'center' }}>
545
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
546
- <rect x="2" y="4" width="20" height="16" rx="2" ry="2"></rect>
547
- <line x1="6" y1="8" x2="6" y2="8"></line>
548
- <line x1="10" y1="8" x2="10" y2="8"></line>
549
- <line x1="14" y1="8" x2="14" y2="8"></line>
550
- <line x1="18" y1="8" x2="18" y2="8"></line>
551
- <line x1="6" y1="12" x2="6" y2="12"></line>
552
- <line x1="10" y1="12" x2="10" y2="12"></line>
553
- <line x1="14" y1="12" x2="14" y2="12"></line>
554
- <line x1="18" y1="12" x2="18" y2="12"></line>
555
- <line x1="7" y1="16" x2="17" y2="16"></line>
556
- </svg>
557
- </span>
558
- <strong>Shortcuts</strong>
559
- </button>
560
597
  </nav>
561
598
 
562
599
  <div className="settings-content">
563
- {/* GENERAL SECTION */}
564
600
  {activeTab === 'sect-general' && (
565
- <div className="tab-pane active">
566
- <section className="setting-section">
567
- <div className="section-heading">
568
- <div>
569
- <p className="section-kicker">AI routing</p>
570
- <h2 class="section-title">Provider & Model</h2>
571
- </div>
572
- <p className="section-description">Choose which AI backend Mint uses, then set the default model.</p>
573
- </div>
574
-
575
- <div className="form-grid compact">
576
- <div className="setting-row wide">
577
- <label>Active Provider</label>
578
- <select value={config.aiProvider} onChange={(e) => updateField('aiProvider', e.target.value)}>
579
- <option value="gemini">Google Gemini (Cloud)</option>
580
- <option value="anthropic">Anthropic Claude</option>
581
- <option value="openai">OpenAI</option>
582
- <option value="openrouter">OpenRouter</option>
583
- <option value="deepseek">DeepSeek</option>
584
- <option value="ollama">Ollama (Local / Private)</option>
585
- <option value="huggingface">Hugging Face (Inference API)</option>
586
- <option value="local_openai">Local (LM Studio / OpenAI Compatible)</option>
587
- </select>
588
- </div>
589
-
590
- <div className="setting-row">
591
- <label>Gemini Model</label>
592
- <select
593
- value={GEMINI_MODELS.includes(config.geminiModel) ? config.geminiModel : 'custom'}
594
- onChange={(e) => updateField('geminiModel', e.target.value)}
595
- >
596
- {GEMINI_MODELS.map(model => (
597
- <option key={model} value={model}>{model}</option>
598
- ))}
599
- <option value="custom">Custom...</option>
600
- </select>
601
- </div>
602
- {(!GEMINI_MODELS.includes(config.geminiModel) || config.geminiModel === 'custom') && (
603
- <div className="setting-row">
604
- <label>Custom Gemini Model</label>
605
- <input
606
- type="text"
607
- value={customGemini}
608
- onChange={(e) => { setCustomGemini(e.target.value); updateField('geminiModel', 'custom') }}
609
- placeholder="e.g. gemini-3.1-flash-lite-preview"
610
- />
611
- </div>
612
- )}
613
-
614
- <div className="setting-row">
615
- <label>OpenAI Model</label>
616
- <select
617
- value={OPENAI_MODELS.includes(config.openaiModel) ? config.openaiModel : 'custom'}
618
- onChange={(e) => updateField('openaiModel', e.target.value)}
619
- >
620
- {OPENAI_MODELS.map(model => (
621
- <option key={model} value={model}>{model}</option>
622
- ))}
623
- <option value="custom">Custom...</option>
624
- </select>
625
- </div>
626
- {(!OPENAI_MODELS.includes(config.openaiModel) || config.openaiModel === 'custom') && (
627
- <div className="setting-row">
628
- <label>Custom OpenAI Model</label>
629
- <input
630
- type="text"
631
- value={customOpenAI}
632
- onChange={(e) => { setCustomOpenAI(e.target.value); updateField('openaiModel', 'custom') }}
633
- placeholder="e.g. gpt-4o"
634
- />
635
- </div>
636
- )}
637
-
638
- <div className="setting-row">
639
- <label>OpenRouter Model</label>
640
- <select
641
- value={OPENROUTER_MODELS.includes(config.openrouterModel) ? config.openrouterModel : 'custom'}
642
- onChange={(e) => updateField('openrouterModel', e.target.value)}
643
- >
644
- {OPENROUTER_MODELS.map(model => (
645
- <option key={model} value={model}>{model}</option>
646
- ))}
647
- <option value="custom">Custom...</option>
648
- </select>
649
- </div>
650
- {(!OPENROUTER_MODELS.includes(config.openrouterModel) || config.openrouterModel === 'custom') && (
651
- <div className="setting-row">
652
- <label>Custom OpenRouter Model</label>
653
- <input
654
- type="text"
655
- value={customOpenRouter}
656
- onChange={(e) => { setCustomOpenRouter(e.target.value); updateField('openrouterModel', 'custom') }}
657
- placeholder="e.g. anthropic/claude-3.5-sonnet"
658
- />
659
- </div>
660
- )}
661
-
662
- <div className="setting-row">
663
- <label>DeepSeek Model</label>
664
- <select
665
- value={DEEPSEEK_MODELS.includes(config.deepseekModel) ? config.deepseekModel : 'custom'}
666
- onChange={(e) => updateField('deepseekModel', e.target.value)}
667
- >
668
- {DEEPSEEK_MODELS.map(model => (
669
- <option key={model} value={model}>{model}</option>
670
- ))}
671
- <option value="custom">Custom...</option>
672
- </select>
673
- </div>
674
- {(!DEEPSEEK_MODELS.includes(config.deepseekModel) || config.deepseekModel === 'custom') && (
675
- <div className="setting-row">
676
- <label>Custom DeepSeek Model</label>
677
- <input
678
- type="text"
679
- value={customDeepSeek}
680
- onChange={(e) => { setCustomDeepSeek(e.target.value); updateField('deepseekModel', 'custom') }}
681
- placeholder="e.g. deepseek-v4-pro"
682
- />
683
- </div>
684
- )}
685
-
686
- <div className="setting-row">
687
- <label>Anthropic Model</label>
688
- <select
689
- value={ANTHROPIC_MODELS.includes(config.anthropicModel) ? config.anthropicModel : 'custom'}
690
- onChange={(e) => updateField('anthropicModel', e.target.value)}
691
- >
692
- {ANTHROPIC_MODELS.map(model => (
693
- <option key={model} value={model}>{model}</option>
694
- ))}
695
- <option value="custom">Custom...</option>
696
- </select>
697
- </div>
698
- {(!ANTHROPIC_MODELS.includes(config.anthropicModel) || config.anthropicModel === 'custom') && (
699
- <div className="setting-row">
700
- <label>Custom Anthropic Model</label>
701
- <input
702
- type="text"
703
- value={customAnthropic}
704
- onChange={(e) => { setCustomAnthropic(e.target.value); updateField('anthropicModel', 'custom') }}
705
- placeholder="e.g. claude-3-5-sonnet-latest"
706
- />
707
- </div>
708
- )}
709
-
710
- <div className="setting-row">
711
- <label>Hugging Face Model</label>
712
- <select
713
- value={HF_MODELS.includes(config.hfModel) ? config.hfModel : 'custom'}
714
- onChange={(e) => updateField('hfModel', e.target.value)}
715
- >
716
- {HF_MODELS.map(model => (
717
- <option key={model} value={model}>{model}</option>
718
- ))}
719
- <option value="custom">Custom...</option>
720
- </select>
721
- </div>
722
- {(!HF_MODELS.includes(config.hfModel) || config.hfModel === 'custom') && (
723
- <div className="setting-row">
724
- <label>Custom Hugging Face Model</label>
725
- <input
726
- type="text"
727
- value={customHF}
728
- onChange={(e) => { setCustomHF(e.target.value); updateField('hfModel', 'custom') }}
729
- placeholder="e.g. meta-llama/Meta-Llama-3-8B-Instruct"
730
- />
731
- </div>
732
- )}
733
-
734
- <div className="setting-row">
735
- <label>LM Studio Model</label>
736
- <select
737
- value={LOCAL_MODELS.includes(config.localModelName) ? config.localModelName : 'custom'}
738
- onChange={(e) => updateField('localModelName', e.target.value)}
739
- >
740
- {LOCAL_MODELS.map(model => (
741
- <option key={model} value={model}>{model}</option>
742
- ))}
743
- <option value="custom">Custom...</option>
744
- </select>
745
- </div>
746
- {(!LOCAL_MODELS.includes(config.localModelName) || config.localModelName === 'custom') && (
747
- <div className="setting-row">
748
- <label>Custom LM Studio Model</label>
749
- <input
750
- type="text"
751
- value={customLocal}
752
- onChange={(e) => { setCustomLocal(e.target.value); updateField('localModelName', 'custom') }}
753
- placeholder="e.g. local-model"
754
- />
755
- </div>
756
- )}
757
-
758
- <div className="setting-row">
759
- <label>Ollama Model</label>
760
- <select
761
- value={OLLAMA_MODELS.includes(config.ollamaModel) ? config.ollamaModel : 'custom'}
762
- onChange={(e) => updateField('ollamaModel', e.target.value)}
763
- >
764
- {OLLAMA_MODELS.map(model => (
765
- <option key={model} value={model}>{model}</option>
766
- ))}
767
- <option value="custom">Custom...</option>
768
- </select>
769
- </div>
770
- {(!OLLAMA_MODELS.includes(config.ollamaModel) || config.ollamaModel === 'custom') && (
771
- <div className="setting-row">
772
- <label>Custom Ollama Model</label>
773
- <input
774
- type="text"
775
- value={customOllama}
776
- onChange={(e) => { setCustomOllama(e.target.value); updateField('ollamaModel', 'custom') }}
777
- placeholder="e.g. llama3:latest"
778
- />
779
- </div>
780
- )}
781
- </div>
782
- </section>
783
-
784
- <section className="setting-section">
785
- <div className="section-heading">
786
- <div>
787
- <p className="section-kicker">Desktop updates</p>
788
- <h2 className="section-title">Signed Tauri Channel</h2>
789
- </div>
790
- <p className="section-description">Check and explicitly install signed Tauri releases from your configured update channel.</p>
791
- </div>
792
- <div className="toggle-row">
793
- <div>
794
- <label>Check signed update channel</label>
795
- <p className="hint">This flag does not install updates automatically.</p>
796
- </div>
797
- <label className="toggle-switch">
798
- <input
799
- type="checkbox"
800
- checked={config.enableAutoUpdate}
801
- onChange={(e) => updateField('enableAutoUpdate', e.target.checked)}
802
- />
803
- <span className="toggle-slider"></span>
804
- </label>
805
- </div>
806
- <div className="form-grid single">
807
- <div className="setting-row">
808
- <label>Updater Endpoint</label>
809
- <input type="text" value={config.updaterEndpoint} onChange={(e) => updateField('updaterEndpoint', e.target.value)} placeholder="https://updates.example.com/latest.json" />
810
- </div>
811
- <div className="setting-row">
812
- <label>Updater Public Key</label>
813
- <textarea value={config.updaterPublicKey} onChange={(e) => updateField('updaterPublicKey', e.target.value)} placeholder="Minisign public key" />
814
- </div>
815
- </div>
816
- <div className="setting-actions">
817
- <button type="button" className="btn-connect" onClick={handleCheckUpdates}>Check for updates</button>
818
- {updateAvailable && <button type="button" className="btn-primary" onClick={handleInstallUpdate}>Install signed update</button>}
819
- </div>
820
- {updateMessage && <p className="hint">{updateMessage}</p>}
821
- </section>
822
-
823
- <section className="setting-section">
824
- <div className="section-heading">
825
- <div>
826
- <p className="section-kicker">Credentials</p>
827
- <h2 class="section-title">API Keys & Hosts</h2>
828
- </div>
829
- </div>
830
-
831
- <div className="form-grid">
832
- <div className="setting-row">
833
- <label>Gemini API Key</label>
834
- <input
835
- type="password"
836
- value={config.apiKey}
837
- onChange={(e) => updateField('apiKey', e.target.value)}
838
- placeholder="Enter Gemini API Key..."
839
- />
840
- </div>
841
- <div className="setting-row">
842
- <label>OpenAI API Key</label>
843
- <input
844
- type="password"
845
- value={config.openaiApiKey}
846
- onChange={(e) => updateField('openaiApiKey', e.target.value)}
847
- placeholder="Enter OpenAI API Key..."
848
- />
849
- </div>
850
- <div className="setting-row">
851
- <label>OpenRouter API Key</label>
852
- <input
853
- type="password"
854
- value={config.openrouterApiKey}
855
- onChange={(e) => updateField('openrouterApiKey', e.target.value)}
856
- placeholder="Enter OpenRouter API Key..."
857
- />
858
- </div>
859
- <div className="setting-row">
860
- <label>DeepSeek API Key</label>
861
- <input
862
- type="password"
863
- value={config.deepseekApiKey}
864
- onChange={(e) => updateField('deepseekApiKey', e.target.value)}
865
- placeholder="Enter DeepSeek API Key..."
866
- />
867
- </div>
868
- <div className="setting-row">
869
- <label>Anthropic API Key</label>
870
- <input
871
- type="password"
872
- value={config.anthropicApiKey}
873
- onChange={(e) => updateField('anthropicApiKey', e.target.value)}
874
- placeholder="Enter Anthropic API Key..."
875
- />
876
- </div>
877
- <div className="setting-row">
878
- <label>Hugging Face API Key</label>
879
- <input
880
- type="password"
881
- value={config.hfApiKey}
882
- onChange={(e) => updateField('hfApiKey', e.target.value)}
883
- placeholder="Enter Hugging Face API Key..."
884
- />
885
- </div>
886
- <div className="setting-row">
887
- <label>LM Studio Base URL</label>
888
- <input
889
- type="text"
890
- value={config.localApiBaseUrl}
891
- onChange={(e) => updateField('localApiBaseUrl', e.target.value)}
892
- placeholder="e.g. http://localhost:1234/v1"
893
- />
894
- </div>
895
- <div className="setting-row">
896
- <label>Ollama Host</label>
897
- <input
898
- type="text"
899
- value={config.ollamaHost}
900
- onChange={(e) => updateField('ollamaHost', e.target.value)}
901
- placeholder="e.g. http://localhost:11434"
902
- />
903
- </div>
904
- </div>
905
- </section>
906
-
907
- <section className="setting-section">
908
- <div className="section-heading">
909
- <div>
910
- <p className="section-kicker">Desktop</p>
911
- <h2 class="section-title">Assistant Presence</h2>
912
- </div>
913
- </div>
914
- <div className="toggle-row">
915
- <div>
916
- <label>Show Desktop AI Candidate</label>
917
- <p className="hint">Show the mini AI character on your desktop.</p>
918
- </div>
919
- <label className="toggle-switch">
920
- <input
921
- type="checkbox"
922
- checked={config.showDesktopWidget}
923
- onChange={(e) => updateField('showDesktopWidget', e.target.checked)}
924
- />
925
- <span className="toggle-slider"></span>
926
- </label>
927
- </div>
928
- </section>
929
- </div>
601
+ <GeneralTab
602
+ config={config}
603
+ updateField={updateField}
604
+ customGemini={customGemini}
605
+ setCustomGemini={setCustomGemini}
606
+ customOpenAI={customOpenAI}
607
+ setCustomOpenAI={setCustomOpenAI}
608
+ customOpenRouter={customOpenRouter}
609
+ setCustomOpenRouter={setCustomOpenRouter}
610
+ customDeepSeek={customDeepSeek}
611
+ setCustomDeepSeek={setCustomDeepSeek}
612
+ customAnthropic={customAnthropic}
613
+ setCustomAnthropic={setCustomAnthropic}
614
+ customHF={customHF}
615
+ setCustomHF={setCustomHF}
616
+ customLocal={customLocal}
617
+ setCustomLocal={setCustomLocal}
618
+ customOllama={customOllama}
619
+ setCustomOllama={setCustomOllama}
620
+ dynamicOllamaModels={dynamicOllamaModels}
621
+ updateAvailable={updateAvailable}
622
+ updateMessage={updateMessage}
623
+ handleCheckUpdates={handleCheckUpdates}
624
+ handleInstallUpdate={handleInstallUpdate}
625
+ />
930
626
  )}
931
627
 
932
- {/* MEMORY SECTION */}
933
628
  {activeTab === 'sect-memory' && (
934
- <div className="tab-pane active animate-fade-in">
935
- <section className="setting-section">
936
- <div className="section-heading">
937
- <div>
938
- <p className="section-kicker">Cross-session Memory</p>
939
- <h2 className="section-title">User Profile & Preferences</h2>
940
- </div>
941
- <p className="section-description">
942
- Information and preferences stored here will be remembered across all conversations. Mint automatically learns and updates your profile details from your chats in the background, but you can also edit them manually.
943
- </p>
944
- </div>
945
-
946
- <div className="form-grid single">
947
- <div className="setting-row">
948
- <label>Your Name / Nickname</label>
949
- <div className="memory-field-container">
950
- <input
951
- type="text"
952
- value={userName}
953
- onChange={(e) => setUserName(e.target.value)}
954
- placeholder="e.g. Pheem, Jane"
955
- />
956
- <p className="hint">Used by the assistant to address you in conversation.</p>
957
- </div>
958
- </div>
959
-
960
- <div className="setting-row">
961
- <label>Custom Instructions & Preferences</label>
962
- <div className="memory-field-container">
963
- <textarea
964
- value={userPreferences}
965
- onChange={(e) => setUserPreferences(e.target.value)}
966
- placeholder="e.g. Explain coding concepts step-by-step. Prefer TypeScript. Talk in Thai. Keep explanations concise."
967
- style={{ minHeight: '150px', resize: 'vertical' }}
968
- />
969
- <p className="hint">Preferences, guidelines, or persona instructions for the assistant.</p>
970
- </div>
971
- </div>
972
- </div>
973
- </section>
974
- </div>
629
+ <MemoryTab
630
+ userName={userName}
631
+ setUserName={setUserName}
632
+ userPreferences={userPreferences}
633
+ setUserPreferences={setUserPreferences}
634
+ />
975
635
  )}
976
636
 
977
- {/* AUDIO SECTION */}
978
637
  {activeTab === 'sect-audio' && (
979
- <div className="tab-pane active">
980
- <section className="setting-section">
981
- <div className="section-heading">
982
- <div>
983
- <p className="section-kicker">Speech</p>
984
- <h2 class="section-title">Voice Reply</h2>
985
- </div>
986
- <p className="section-description">Control spoken responses and TTS behavior.</p>
987
- </div>
988
-
989
- <div className="toggle-row">
990
- <div>
991
- <label>Enable Voice Reply</label>
992
- <p className="hint">Mint will speak responses out loud when this is enabled.</p>
993
- </div>
994
- <label className="toggle-switch">
995
- <input
996
- type="checkbox"
997
- checked={config.enableVoiceReply}
998
- onChange={(e) => updateField('enableVoiceReply', e.target.checked)}
999
- />
1000
- <span className="toggle-slider"></span>
1001
- </label>
1002
- </div>
1003
-
1004
- <div className="form-grid single">
1005
- <div className="setting-row">
1006
- <label>Voice Engine</label>
1007
- <select value={config.ttsProvider} onChange={(e) => updateField('ttsProvider', e.target.value)}>
1008
- <option value="google">Google Cloud (Natural, Auto Lang)</option>
1009
- <option value="native">OS Native (Supports Pitch)</option>
1010
- </select>
1011
- </div>
1012
- </div>
1013
-
1014
- <div className="slider-stack">
1015
- <div className="setting-row">
1016
- <label>Volume</label>
1017
- <div className="slider-group">
1018
- <input
1019
- type="range"
1020
- min="0"
1021
- max="1"
1022
- step="0.1"
1023
- value={config.ttsVolume}
1024
- onChange={(e) => updateField('ttsVolume', parseFloat(e.target.value))}
1025
- className="range-slider"
1026
- />
1027
- <span className="range-value">{Math.round(config.ttsVolume * 100)}%</span>
1028
- </div>
1029
- </div>
1030
- <div className="setting-row">
1031
- <label>Speed</label>
1032
- <div className="slider-group">
1033
- <input
1034
- type="range"
1035
- min="0.5"
1036
- max="2"
1037
- step="0.1"
1038
- value={config.ttsSpeed}
1039
- onChange={(e) => updateField('ttsSpeed', parseFloat(e.target.value))}
1040
- className="range-slider"
1041
- />
1042
- <span className="range-value">{parseFloat(String(config.ttsSpeed)).toFixed(1)}x</span>
1043
- </div>
1044
- </div>
1045
- <div className="setting-row">
1046
- <label>Pitch</label>
1047
- <div className="slider-group">
1048
- <input
1049
- type="range"
1050
- min="0"
1051
- max="2"
1052
- step="0.1"
1053
- value={config.ttsPitch}
1054
- onChange={(e) => updateField('ttsPitch', parseFloat(e.target.value))}
1055
- className="range-slider"
1056
- />
1057
- <span className="range-value">{parseFloat(String(config.ttsPitch)).toFixed(1)}</span>
1058
- </div>
1059
- <p className="hint">Pitch applies to OS native voice only.</p>
1060
- </div>
1061
- </div>
1062
- </section>
1063
- </div>
638
+ <AudioTab
639
+ config={config}
640
+ updateField={updateField}
641
+ />
1064
642
  )}
1065
643
 
1066
- {/* AUTOMATION SECTION */}
1067
644
  {activeTab === 'sect-automation' && (
1068
- <div className="tab-pane active">
1069
- <section className="setting-section">
1070
- <div className="section-heading">
1071
- <div>
1072
- <p className="section-kicker">Browser</p>
1073
- <h2 class="section-title">Automation Engine</h2>
1074
- </div>
1075
- </div>
1076
- <div className="form-grid single">
1077
- <div className="setting-row">
1078
- <label>Browser Engine</label>
1079
- <select value={config.automationBrowser} onChange={(e) => updateField('automationBrowser', e.target.value)}>
1080
- <option value="chromium">Chromium (Bundled)</option>
1081
- <option value="/usr/bin/firefox">Firefox (System - Linux)</option>
1082
- </select>
1083
- </div>
1084
- <div className="setting-row">
1085
- <label>Chromium DevTools Endpoint</label>
1086
- <input type="text" value={config.browserDebugUrl} onChange={(e) => updateField('browserDebugUrl', e.target.value)} />
1087
- <p className="hint">Required for native tab reading and selector clicks.</p>
1088
- </div>
1089
- <div className="setting-row">
1090
- <label>Browser Extension Context Endpoint</label>
1091
- <input type="text" value={config.browserExtensionContextUrl} onChange={(e) => updateField('browserExtensionContextUrl', e.target.value)} />
1092
- <p className="hint">Fallback endpoint used when Chromium remote debugging is unavailable.</p>
1093
- </div>
1094
- </div>
1095
- </section>
1096
-
1097
- <section className="setting-section">
1098
- <div className="section-heading">
1099
- <div>
1100
- <p className="section-kicker">Background tasks</p>
1101
- <h2 className="section-title">Native Headless Queue</h2>
1102
- </div>
1103
- </div>
1104
- <div className="toggle-row">
1105
- <div>
1106
- <label>Process queued tasks automatically</label>
1107
- <p className="hint">Allow the bounded Rust worker to process pending tasks every 15 seconds.</p>
1108
- </div>
1109
- <label className="toggle-switch">
1110
- <input
1111
- type="checkbox"
1112
- checked={config.enableHeadlessTaskQueue}
1113
- onChange={(e) => updateField('enableHeadlessTaskQueue', e.target.checked)}
1114
- />
1115
- <span className="toggle-slider"></span>
1116
- </label>
1117
- </div>
1118
- </section>
1119
-
1120
- <section className="setting-section">
1121
- <div className="section-heading">
1122
- <div>
1123
- <p className="section-kicker">Awareness</p>
1124
- <h2 class="section-title">Proactive Assistant</h2>
1125
- </div>
1126
- <p className="section-description">Tune screen analysis frequency and suggestion timing.</p>
1127
- </div>
1128
- <div className="slider-stack">
1129
- <div className="setting-row">
1130
- <label>Screen Capture Frequency</label>
1131
- <div className="slider-group">
1132
- <input
1133
- type="range"
1134
- min="30"
1135
- max="300"
1136
- step="30"
1137
- value={config.proactiveInterval}
1138
- onChange={(e) => updateField('proactiveInterval', parseInt(e.target.value))}
1139
- className="range-slider"
1140
- />
1141
- <span className="range-value">{config.proactiveInterval} sec</span>
1142
- </div>
1143
- <p className="hint">Lower values respond faster but use more API calls.</p>
1144
- </div>
1145
- <div className="setting-row">
1146
- <label>Suggestion Cooldown</label>
1147
- <div className="slider-group">
1148
- <input
1149
- type="range"
1150
- min="60"
1151
- max="600"
1152
- step="60"
1153
- value={config.proactiveCooldown}
1154
- onChange={(e) => updateField('proactiveCooldown', parseInt(e.target.value))}
1155
- className="range-slider"
1156
- />
1157
- <span className="range-value">{Math.round(config.proactiveCooldown / 60)} min</span>
1158
- </div>
1159
- <p className="hint">Minimum time between repeat suggestions.</p>
1160
- </div>
1161
- </div>
1162
- </section>
1163
-
1164
- <section className="setting-section">
1165
- <div className="section-heading">
1166
- <div>
1167
- <p className="section-kicker">Messaging</p>
1168
- <h2 className="section-title">Native Channel Bridges</h2>
1169
- </div>
1170
- <p className="section-description">Configure credentials used directly by the Rust channel workers.</p>
1171
- </div>
1172
- <div className="form-grid">
1173
- <label className="toggle-row"><span>Telegram Bot API</span><input type="checkbox" checked={config.enableTelegramBridge} onChange={(e) => updateField('enableTelegramBridge', e.target.checked)} /></label>
1174
- <input type="password" placeholder="Telegram bot token" value={config.telegramBotToken} onChange={(e) => updateField('telegramBotToken', e.target.value)} />
1175
- <label className="toggle-row"><span>Discord Gateway</span><input type="checkbox" checked={config.enableDiscordBridge} onChange={(e) => updateField('enableDiscordBridge', e.target.checked)} /></label>
1176
- <input type="password" placeholder="Discord bot token" value={config.discordBotToken} onChange={(e) => updateField('discordBotToken', e.target.value)} />
1177
- <input type="text" placeholder="Discord application ID for Rich Presence" value={config.discordApplicationId} onChange={(e) => updateField('discordApplicationId', e.target.value)} />
1178
- <label className="toggle-row"><span>Slack Socket Mode</span><input type="checkbox" checked={config.enableSlackBridge} onChange={(e) => updateField('enableSlackBridge', e.target.checked)} /></label>
1179
- <input type="password" placeholder="Slack bot token (xoxb-...)" value={config.slackBotToken} onChange={(e) => updateField('slackBotToken', e.target.value)} />
1180
- <input type="password" placeholder="Slack app token (xapp-...)" value={config.slackAppToken} onChange={(e) => updateField('slackAppToken', e.target.value)} />
1181
- <label className="toggle-row"><span>LINE Webhook</span><input type="checkbox" checked={config.enableLineBridge} onChange={(e) => updateField('enableLineBridge', e.target.checked)} /></label>
1182
- <input type="password" placeholder="LINE channel access token" value={config.lineChannelAccessToken} onChange={(e) => updateField('lineChannelAccessToken', e.target.value)} />
1183
- <input type="password" placeholder="LINE channel secret" value={config.lineChannelSecret} onChange={(e) => updateField('lineChannelSecret', e.target.value)} />
1184
- <label className="toggle-row"><span>WhatsApp Cloud API</span><input type="checkbox" checked={config.enableWhatsappBridge} onChange={(e) => updateField('enableWhatsappBridge', e.target.checked)} /></label>
1185
- <input type="password" placeholder="WhatsApp Cloud access token" value={config.whatsappCloudAccessToken} onChange={(e) => updateField('whatsappCloudAccessToken', e.target.value)} />
1186
- <input type="text" placeholder="WhatsApp phone number ID" value={config.whatsappPhoneNumberId} onChange={(e) => updateField('whatsappPhoneNumberId', e.target.value)} />
1187
- <input type="password" placeholder="WhatsApp verify token" value={config.whatsappVerifyToken} onChange={(e) => updateField('whatsappVerifyToken', e.target.value)} />
1188
- <input type="password" placeholder="WhatsApp app secret (optional HMAC validation)" value={config.whatsappAppSecret} onChange={(e) => updateField('whatsappAppSecret', e.target.value)} />
1189
- </div>
1190
- </section>
1191
-
1192
- <section className="setting-section">
1193
- <div className="section-heading">
1194
- <div>
1195
- <p className="section-kicker">Rules</p>
1196
- <h2 class="section-title">Custom Workflows</h2>
1197
- </div>
1198
- </div>
1199
- <div className="toggle-row">
1200
- <div>
1201
- <label>Enable Custom Workflows</label>
1202
- <p className="hint">Run "If This Then Mint" rules from the workflow JSON file.</p>
1203
- </div>
1204
- <label className="toggle-switch">
1205
- <input
1206
- type="checkbox"
1207
- checked={config.enableCustomWorkflows}
1208
- onChange={(e) => updateField('enableCustomWorkflows', e.target.checked)}
1209
- />
1210
- <span className="toggle-slider"></span>
1211
- </label>
1212
- </div>
1213
- <div className="button-row" style={{ display: 'flex', gap: '10px', marginTop: '10px' }}>
1214
- <button className="btn btn-secondary" onClick={handleOpenWorkflows}>Open workflows.json</button>
1215
- <button className="btn btn-primary" onClick={handleReloadWorkflows}>Reload Rules</button>
1216
- </div>
1217
- </section>
1218
-
1219
- <section className="setting-section">
1220
- <div className="section-heading">
1221
- <div>
1222
- <p className="section-kicker">Code mode</p>
1223
- <h2 class="section-title">Agent Collaboration</h2>
1224
- </div>
1225
- </div>
1226
- <div className="toggle-row">
1227
- <div>
1228
- <label>Enable Multi-Agent Review</label>
1229
- <p className="hint">Allow a secondary model to review code written by the primary model.</p>
1230
- </div>
1231
- <label className="toggle-switch">
1232
- <input
1233
- type="checkbox"
1234
- checked={config.enableAgentCollaboration}
1235
- onChange={(e) => updateField('enableAgentCollaboration', e.target.checked)}
1236
- />
1237
- <span className="toggle-slider"></span>
1238
- </label>
1239
- </div>
1240
- </section>
1241
- </div>
645
+ <AutomationTab
646
+ config={config}
647
+ updateField={updateField}
648
+ handleOpenWorkflows={handleOpenWorkflows}
649
+ handleReloadWorkflows={handleReloadWorkflows}
650
+ />
1242
651
  )}
1243
652
 
1244
- {/* THEME & UI SECTION */}
1245
653
  {activeTab === 'sect-theme' && (
1246
- <div className="tab-pane active">
1247
- <section className="setting-section">
1248
- <div className="section-heading">
1249
- <div>
1250
- <p className="section-kicker">Appearance</p>
1251
- <h2 class="section-title">Theme</h2>
1252
- </div>
1253
- </div>
1254
- <div className="theme-grid" style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '12px' }}>
1255
- {(['dark', 'light', 'midnight', 'custom'] as const).map(t => (
1256
- <button
1257
- key={t}
1258
- className={`theme-card ${config.theme === t ? 'active' : ''}`}
1259
- onClick={() => updateField('theme', t)}
1260
- >
1261
- <div className={`theme-preview ${t}-preview`}></div>
1262
- <span style={{ textTransform: 'capitalize' }}>{t}</span>
1263
- </button>
1264
- ))}
1265
- </div>
1266
-
1267
- {config.theme === 'custom' && (
1268
- <div className="custom-theme-panel" style={{ marginTop: '15px' }}>
1269
- <div className="setting-row">
1270
- <label>Background Gradient</label>
1271
- <div className="color-range" style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
1272
- <input type="color" value={config.customBgStart} onChange={(e) => updateField('customBgStart', e.target.value)} />
1273
- <span style={{ display: 'inline-flex', alignItems: 'center', color: 'var(--text-soft)' }}>
1274
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1275
- <line x1="5" y1="12" x2="19" y2="12"></line>
1276
- <polyline points="12 5 19 12 12 19"></polyline>
1277
- </svg>
1278
- </span>
1279
- <input type="color" value={config.customBgEnd} onChange={(e) => updateField('customBgEnd', e.target.value)} />
1280
- </div>
1281
- </div>
1282
- <div className="setting-row">
1283
- <label>Panel Background</label>
1284
- <input type="color" value={config.customPanelBg} onChange={(e) => updateField('customPanelBg', e.target.value)} />
1285
- </div>
1286
- </div>
1287
- )}
1288
- </section>
1289
-
1290
- <section className="setting-section">
1291
- <div className="section-heading">
1292
- <div>
1293
- <p className="section-kicker">Color</p>
1294
- <h2 class="section-title">Accent & Text</h2>
1295
- </div>
1296
- </div>
1297
- <div className="color-section">
1298
- <div>
1299
- <label>Accent Color</label>
1300
- <div className="color-presets">
1301
- {['#8b5cf6', '#06b6d4', '#10b981', '#f59e0b', '#ef4444', '#ec4899'].map(c => (
1302
- <button
1303
- key={c}
1304
- className="color-dot"
1305
- style={{ backgroundColor: c, border: config.accentColor === c ? '2px solid white' : 'none' }}
1306
- onClick={() => updateField('accentColor', c)}
1307
- />
1308
- ))}
1309
- </div>
1310
- </div>
1311
- <div className="color-inputs" style={{ display: 'flex', gap: '15px', marginTop: '12px' }}>
1312
- <div>
1313
- <label>Custom Accent</label>
1314
- <input type="color" value={config.accentColor} onChange={(e) => updateField('accentColor', e.target.value)} style={{ display: 'block', marginTop: '4px' }} />
1315
- </div>
1316
- <div>
1317
- <label>System Text</label>
1318
- <input type="color" value={config.systemTextColor} onChange={(e) => updateField('systemTextColor', e.target.value)} style={{ display: 'block', marginTop: '4px' }} />
1319
- </div>
1320
- </div>
1321
- </div>
1322
- </section>
1323
-
1324
- <section className="setting-section">
1325
- <div className="section-heading">
1326
- <div>
1327
- <p className="section-kicker">Surface</p>
1328
- <h2 class="section-title">Interface Style</h2>
1329
- </div>
1330
- </div>
1331
- <div className="form-grid">
1332
- <div className="setting-row">
1333
- <label>Glass Blur</label>
1334
- <select value={config.glassBlur} onChange={(e) => updateField('glassBlur', e.target.value)}>
1335
- <option value="blur(4px)">Low (4px)</option>
1336
- <option value="blur(16px)">Medium (16px) - Default</option>
1337
- <option value="blur(32px)">High (32px)</option>
1338
- <option value="none">Off (Solid)</option>
1339
- </select>
1340
- </div>
1341
- <div className="setting-row">
1342
- <label>Font Family</label>
1343
- <select value={config.fontFamily} onChange={(e) => updateField('fontFamily', e.target.value)}>
1344
- <option value="'Outfit', sans-serif">Outfit (Default)</option>
1345
- <option value="'Mali', cursive">Mali (Cute Thai Font)</option>
1346
- <option value="'Prompt', sans-serif">Prompt (Modern Thai)</option>
1347
- <option value="'Sarabun', sans-serif">Sarabun (Formal Thai)</option>
1348
- </select>
1349
- </div>
1350
- <div className="setting-row">
1351
- <label>Font Size</label>
1352
- <select value={config.fontSize} onChange={(e) => updateField('fontSize', e.target.value)}>
1353
- <option value="16px">Small</option>
1354
- <option value="18px">Medium (Default)</option>
1355
- <option value="22px">Large</option>
1356
- <option value="26px">Extra Large</option>
1357
- <option value="30px">Extra Extra Large</option>
1358
- </select>
1359
- </div>
1360
- </div>
1361
- </section>
1362
- </div>
654
+ <ThemeTab
655
+ config={config}
656
+ updateField={updateField}
657
+ />
1363
658
  )}
1364
659
 
1365
- {/* PLUGINS SECTION */}
1366
660
  {activeTab === 'sect-plugins' && (
1367
- <div className="tab-pane active">
1368
- <section className="setting-section">
1369
- <div className="section-heading">
1370
- <div>
1371
- <p className="section-kicker">Integrations</p>
1372
- <h2 class="section-title">Built-in Plugins</h2>
1373
- </div>
1374
- </div>
1375
- <div className="plugin-list">
1376
- {[
1377
- { key: 'spotify', name: 'Spotify', desc: 'Control playback with AI. Requires playerctl.', icon: '🎵' },
1378
- { key: 'calendar', name: 'Google Calendar', desc: 'Read and schedule events.', icon: '📅' },
1379
- { key: 'gmail', name: 'Gmail', desc: 'Read email and create drafts safely.', icon: '✉' },
1380
- { key: 'notion', name: 'Notion', desc: 'Create notes, pages, and read databases.', icon: '📝' },
1381
- { key: 'discord', name: 'Discord RPC', desc: 'Show "Using Mint Assistant" on Discord status.', icon: '💬' },
1382
- ].map(p => (
1383
- <div className="plugin-card" key={p.key}>
1384
- <div className="plugin-icon">{p.icon}</div>
1385
- <div className="plugin-info">
1386
- <div className="plugin-name">{p.name}</div>
1387
- <div className="plugin-desc">{p.desc}</div>
1388
- </div>
1389
- <div className="plugin-actions">
1390
- <button className="btn-connect" onClick={() => handleConnectPlugin(p.key)}>Connect</button>
1391
- </div>
1392
- </div>
1393
- ))}
1394
- </div>
1395
- </section>
1396
-
1397
- <section className="setting-section">
1398
- <div className="section-heading">
1399
- <div>
1400
- <p className="section-kicker">External tools</p>
1401
- <h2 class="section-title">MCP Servers</h2>
1402
- </div>
1403
- <p className="section-description">Connect Mint to tools like search, GitHub, or filesystem servers.</p>
1404
- </div>
1405
-
1406
- <div className="mcp-list">
1407
- {Object.entries(config.mcpServers || {}).map(([name, srv]: [string, any]) => (
1408
- <div className="plugin-card" key={name} style={{ marginBottom: '10px' }}>
1409
- <div className="plugin-icon">⚙</div>
1410
- <div className="plugin-info">
1411
- <div className="plugin-name">{name}</div>
1412
- <div className="plugin-desc" style={{ fontFamily: 'monospace', fontSize: '0.8rem' }}>
1413
- Command: {srv.command} {srv.args?.join(' ')}
1414
- </div>
1415
- </div>
1416
- <div className="plugin-actions">
1417
- <button className="btn btn-danger" onClick={() => handleRemoveMcpServer(name)}>Remove</button>
1418
- </div>
1419
- </div>
1420
- ))}
1421
- </div>
1422
-
1423
- <div className="add-mcp-box">
1424
- <h3>Add MCP Server</h3>
1425
- <div className="form-grid">
1426
- <input type="text" placeholder="Server Name (e.g. google-search)" value={mcpName} onChange={(e) => setMcpName(e.target.value)} />
1427
- <input type="text" placeholder="Command (e.g. npx)" value={mcpCmd} onChange={(e) => setMcpCmd(e.target.value)} />
1428
- </div>
1429
- <input type="text" placeholder="Arguments (e.g. -y @modelcontextprotocol/server-brave-search)" value={mcpArgs} onChange={(e) => setMcpArgs(e.target.value)} style={{ width: '100%', marginTop: '8px' }} />
1430
- <textarea placeholder='Env JSON, e.g. {"BRAVE_API_KEY": "..."}' value={mcpEnv} onChange={(e) => setMcpEnv(e.target.value)} style={{ width: '100%', marginTop: '8px', height: '60px' }}></textarea>
1431
- <button className="btn-primary full-width" onClick={handleAddMcpServer} style={{ marginTop: '10px', width: '100%' }}>Add MCP Server</button>
1432
- </div>
1433
- </section>
1434
- </div>
1435
- )}
1436
-
1437
- {/* KEYBOARD SHORTCUTS SECTION */}
1438
- {activeTab === 'sect-shortcuts' && (
1439
- <div className="tab-pane active">
1440
- <section className="setting-section">
1441
- <div className="section-heading">
1442
- <div>
1443
- <p className="section-kicker">Keyboard</p>
1444
- <h2 class="section-title">Shortcuts</h2>
1445
- </div>
1446
- </div>
1447
- <div className="shortcut-list">
1448
- <div className="shortcut-item">
1449
- <span>Show / Hide Mint Window</span>
1450
- <div className="keys"><kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>Space</kbd></div>
1451
- </div>
1452
- <div className="shortcut-item">
1453
- <span>Open Spotlight</span>
1454
- <div className="keys"><kbd>Alt</kbd><kbd>Space</kbd></div>
1455
- </div>
1456
- <div className="shortcut-item">
1457
- <span>Close / Dismiss</span>
1458
- <div className="keys"><kbd>Esc</kbd></div>
1459
- </div>
1460
- </div>
1461
- </section>
1462
- </div>
661
+ <PluginsTab
662
+ config={config}
663
+ updateField={updateField}
664
+ mcpName={mcpName}
665
+ setMcpName={setMcpName}
666
+ mcpCmd={mcpCmd}
667
+ setMcpCmd={setMcpCmd}
668
+ mcpArgs={mcpArgs}
669
+ setMcpArgs={setMcpArgs}
670
+ mcpEnv={mcpEnv}
671
+ setMcpEnv={setMcpEnv}
672
+ handleAddMcpServer={handleAddMcpServer}
673
+ handleRemoveMcpServer={handleRemoveMcpServer}
674
+ handleConnectPlugin={handleConnectPlugin}
675
+ />
1463
676
  )}
1464
677
  </div>
1465
678
  </main>