Add field for Anthropic API key in settings

This commit is contained in:
Abi Raja 2024-05-17 12:30:26 -04:00
parent 1f61d02da6
commit ac8198e5ba
2 changed files with 21 additions and 0 deletions

View File

@ -108,6 +108,26 @@ function SettingsDialog({ settings, setSettings }: Props) {
</> </>
)} )}
<Label htmlFor="anthropic-api-key">
<div>Anthropic API key</div>
<div className="font-light mt-2 leading-relaxed">
Only stored in your browser. Never stored on servers. Overrides
your .env config.
</div>
</Label>
<Input
id="anthropic-api-key"
placeholder="Anthropic API key"
value={settings.anthropicApiKey || ""}
onChange={(e) =>
setSettings((s) => ({
...s,
anthropicApiKey: e.target.value,
}))
}
/>
<Accordion type="single" collapsible className="w-full"> <Accordion type="single" collapsible className="w-full">
<AccordionItem value="item-1"> <AccordionItem value="item-1">
<AccordionTrigger>Screenshot by URL Config</AccordionTrigger> <AccordionTrigger>Screenshot by URL Config</AccordionTrigger>

View File

@ -16,6 +16,7 @@ export interface Settings {
codeGenerationModel: CodeGenerationModel; codeGenerationModel: CodeGenerationModel;
// Only relevant for hosted version // Only relevant for hosted version
isTermOfServiceAccepted: boolean; isTermOfServiceAccepted: boolean;
anthropicApiKey: string | null; // Added property for anthropic API key
} }
export enum AppState { export enum AppState {