Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ const Popup: React.FC = () => {
setApikey((await getKeyModel(await selectModel())).apiKey)
}
}

const getApiKeyPlaceholder = (model: ValidModel | null | undefined) => {
if (!model) return "Enter API Key"
if (model.startsWith('openai')) return "Enter OpenAI API Key"
if (model.startsWith('gemini')) return "Enter Google API Key"
return "Enter API Key"
}
return (
<div className="relative p-4 w-[350px] bg-background">
<Show show={isLoaded}>
Expand Down Expand Up @@ -136,14 +141,15 @@ const Popup: React.FC = () => {
<label htmlFor="text" className="text-xs text-muted-foreground">
API Key {model ? `for ${model}` : ''}
</label>
<HideApiKey
<HideApiKey
value={apikey || ''}
onChange={(e) => setApikey(e.target.value)}
placeholder="Enter OpenAI API Key"
placeholder={getApiKeyPlaceholder(selectedModel)}
disabled={!model}
required
/>
</div>
</div>
<Button disabled={isloading} type="submit" className="w-full mt-2">
save API Key
</Button>
Expand Down