Skip to content

Commit cb757d7

Browse files
authored
Merge pull request #12 from marcofaggian/feat/providers-name-in-config
feat(config): use provider's name
2 parents ac023b9 + 978c58e commit cb757d7

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

app/components/ui/ProviderKeys.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { LLMProvider } from '@/src/llm/types';
22

3-
const providerNames: Record<LLMProvider, string> = {
3+
export const providerNames: Record<LLMProvider, string> = {
44
anthropic: 'Anthropic',
55
gemini: 'Gemini',
66
openai: 'OpenAI',

app/components/ui/Settings.tsx

+45-45
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Description, Field, FieldGroup, Label } from '../catalyst/fieldset';
1414
import { Input } from '../catalyst/input';
1515
import { Select } from '../catalyst/select';
1616
import { Spinner } from '../Spinner';
17-
import { ProviderKeysHint } from './ProviderKeys';
17+
import { ProviderKeysHint, providerNames } from './ProviderKeys';
1818
import { Recommended, recommendedForProvider } from './Recommended';
1919

2020
export function Settings({ close }: { close: () => void }) {
@@ -106,14 +106,57 @@ export function Settings({ close }: { close: () => void }) {
106106
>
107107
{providers.map((prov) => (
108108
<option key={prov} value={prov}>
109-
{prov}
109+
{prov == 'local' ? 'local' : providerNames[prov]}
110110
</option>
111111
))}
112112
</Select>
113113
<Recommended />
114114
</div>
115115
</Field>
116116

117+
{config.provider === 'ollama' && (
118+
<Field>
119+
<Label>Ollama URL</Label>
120+
<Input
121+
type="text"
122+
placeholder="http://localhost:11434"
123+
value={config.llmKey}
124+
onChange={(e) =>
125+
setConfig((c) => ({
126+
...c,
127+
llmKey: e.target.value,
128+
}))
129+
}
130+
/>
131+
<Description className="mt-4 mx-1 !text-xs">
132+
Please note that your Ollama instance must have CORS enabled for
133+
LitLytics to work correctly in browser environment.
134+
</Description>
135+
</Field>
136+
)}
137+
138+
{config.provider !== 'local' && config.provider !== 'ollama' && (
139+
<Field>
140+
<Label>API Key</Label>
141+
<Input
142+
type="password"
143+
value={config.llmKey}
144+
onChange={(e) =>
145+
setConfig((c) => ({
146+
...c,
147+
llmKey: e.target.value,
148+
}))
149+
}
150+
/>
151+
{Boolean(config.llmKey?.length) && (
152+
<Description>
153+
Your key is stored only in your browser and passed directly to
154+
API provider.
155+
</Description>
156+
)}
157+
</Field>
158+
)}
159+
117160
<Field>
118161
<Label>Model</Label>
119162
{config.provider === 'ollama' && (
@@ -161,49 +204,6 @@ export function Settings({ close }: { close: () => void }) {
161204
)}
162205
</Field>
163206

164-
{config.provider === 'ollama' && (
165-
<Field>
166-
<Label>Ollama URL</Label>
167-
<Input
168-
type="text"
169-
placeholder="http://localhost:11434"
170-
value={config.llmKey}
171-
onChange={(e) =>
172-
setConfig((c) => ({
173-
...c,
174-
llmKey: e.target.value,
175-
}))
176-
}
177-
/>
178-
<Description className="mt-4 mx-1 !text-xs">
179-
Please note that your Ollama instance must have CORS enabled for
180-
LitLytics to work correctly in browser environment.
181-
</Description>
182-
</Field>
183-
)}
184-
185-
{config.provider !== 'local' && config.provider !== 'ollama' && (
186-
<Field>
187-
<Label>API Key</Label>
188-
<Input
189-
type="password"
190-
value={config.llmKey}
191-
onChange={(e) =>
192-
setConfig((c) => ({
193-
...c,
194-
llmKey: e.target.value,
195-
}))
196-
}
197-
/>
198-
{Boolean(config.llmKey?.length) && (
199-
<Description>
200-
Your key is stored only in your browser and passed directly to
201-
API provider.
202-
</Description>
203-
)}
204-
</Field>
205-
)}
206-
207207
{config.provider === 'local' && (
208208
<Field className="flex flex-col">
209209
<div className="flex items-center gap-2">

0 commit comments

Comments
 (0)