-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathsettings.tsx
More file actions
162 lines (148 loc) · 5.5 KB
/
settings.tsx
File metadata and controls
162 lines (148 loc) · 5.5 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
import { useState, useEffect } from 'react';
import { createRoot } from 'react-dom/client';
import type { Settings } from './types';
const PROVIDER_MODELS = {
google: [
{ id: 'gemini-2.5-pro', name: 'Gemini 2.5 Pro', description: '1M token context' },
{ id: 'gemini-2.5-flash', name: 'Gemini 2.5 Flash', description: 'Fast and efficient' },
{ id: 'gemini-2.5-flash-lite', name: 'Gemini 2.5 Flash Lite', description: 'Optimized for speed' },
],
};
function SettingsPage() {
const [settings, setSettings] = useState<Settings>({
provider: 'google',
apiKey: '',
model: 'gemini-2.5-pro',
toolMode: 'tool-router',
composioApiKey: '',
});
const [saved, setSaved] = useState(false);
const [showApiKey, setShowApiKey] = useState(false);
const [showComposioKey, setShowComposioKey] = useState(false);
useEffect(() => {
// Load settings from chrome.storage
chrome.storage.local.get(['atlasSettings'], (result) => {
if (result.atlasSettings) {
setSettings(result.atlasSettings);
}
});
}, []);
const handleSave = () => {
chrome.storage.local.set({ atlasSettings: settings }, () => {
setSaved(true);
setTimeout(() => setSaved(false), 3000);
// Send message to sidebar to refresh
chrome.runtime.sendMessage({ type: 'SETTINGS_UPDATED' }, () => {
if (chrome.runtime.lastError) {
console.log('Sidebar not active, but settings saved');
}
});
});
};
return (
<div className="settings-container">
<div className="settings-header">
<h1>Settings</h1>
<p>Configure your AI provider and preferences</p>
</div>
<div className="settings-content">
<div className="setting-group">
<label>AI Provider</label>
<div className="provider-info">
<p>Google Gemini</p>
</div>
</div>
<div className="setting-group">
<label>Model</label>
<select
value={settings.model}
onChange={(e) => setSettings({ ...settings, model: e.target.value })}
className="model-select"
>
{PROVIDER_MODELS[settings.provider].map((model) => (
<option key={model.id} value={model.id}>
{model.name} - {model.description}
</option>
))}
</select>
</div>
<div className="setting-group">
<label>Composio API Key</label>
<div className="api-key-input-wrapper">
<input
type={showComposioKey ? 'text' : 'password'}
value={settings.composioApiKey || ''}
onChange={(e) => setSettings({ ...settings, composioApiKey: e.target.value })}
placeholder="Enter your Composio API key (optional)"
className="api-key-input"
/>
<button
type="button"
className="toggle-visibility"
onClick={() => setShowComposioKey(!showComposioKey)}
>
{showComposioKey ? '👁️' : '👁️🗨️'}
</button>
</div>
<p className="help-text">
Enable Composio Tool Router for access to 500+ app integrations. Get your key from{' '}
<a href="https://app.composio.dev/settings" target="_blank" rel="noopener noreferrer">
Composio Dashboard
</a>
</p>
</div>
<div className="setting-group">
<label>Google API Key</label>
<div className="api-key-input-wrapper">
<input
type={showApiKey ? 'text' : 'password'}
value={settings.apiKey}
onChange={(e) => setSettings({ ...settings, apiKey: e.target.value })}
placeholder="Enter your Google API key"
className="api-key-input"
/>
<button
type="button"
className="toggle-visibility"
onClick={() => setShowApiKey(!showApiKey)}
>
{showApiKey ? '👁️' : '👁️🗨️'}
</button>
</div>
<p className="help-text">
Get your API key from:{' '}
<a href="https://aistudio.google.com/app/apikey" target="_blank" rel="noopener noreferrer">
Google AI Studio
</a>
</p>
</div>
<button
className={`save-button ${saved ? 'saved' : ''}`}
onClick={handleSave}
disabled={!settings.apiKey}
>
{saved ? '✓ Saved!' : 'Save Settings'}
</button>
<div className="feature-cards">
<div className="feature-card">
<div className="feature-icon">◉</div>
<h3>Browser Tools</h3>
<p>Click the Browser Tools button (◉) to enable Gemini 2.5 Computer Use for direct browser automation with screenshots</p>
</div>
<div className="feature-card">
<div className="feature-icon">🔧</div>
<h3>Tool Router</h3>
<p>Add Composio API key to access 500+ integrations (Gmail, Slack, GitHub, etc.) via AI SDK</p>
</div>
</div>
<div className="info-box">
<h3>🔒 Privacy & Security</h3>
<p>Your API keys are stored locally in your browser and only sent to the respective AI providers. Never shared with third parties.</p>
</div>
</div>
</div>
);
}
const container = document.getElementById('root');
const root = createRoot(container!);
root.render(<SettingsPage />);