diff --git a/apps/desktop/src/api.ts b/apps/desktop/src/api.ts index 33b6f21..7f9fec3 100644 --- a/apps/desktop/src/api.ts +++ b/apps/desktop/src/api.ts @@ -8,6 +8,7 @@ export interface Provider { name: string; provider_type: ProviderType; base_url: string; + api_key?: string; has_api_key: boolean; custom_headers: Record; extra_params: Record; diff --git a/apps/desktop/src/components/ProviderEditor.tsx b/apps/desktop/src/components/ProviderEditor.tsx index 42bd828..9369f0e 100644 --- a/apps/desktop/src/components/ProviderEditor.tsx +++ b/apps/desktop/src/components/ProviderEditor.tsx @@ -1,5 +1,5 @@ import type { ProviderInput, ProviderType } from "../api"; -import { FormField, TextInput } from "./ui/FormControls"; +import { FormField, SecretTextInput, TextInput } from "./ui/FormControls"; import { JsonEditor } from "./ui/JsonEditor"; import { Select } from "./ui/Select"; import { claudeIcon, openAiIcon } from "./ui/icons"; @@ -23,7 +23,7 @@ export function ProviderEditor({ value, headersText, extraText, editing, onChang { value: "anthropic", label: "Anthropic", icon: claudeIcon }, ]} onChange={(provider_type) => patch({ provider_type: provider_type as ProviderType })} /> patch({ base_url: event.target.value })} /> - patch({ api_key: event.target.value })} /> + patch({ api_key: event.target.value })} /> ; diff --git a/apps/desktop/src/components/cursor/CursorModelEditor.tsx b/apps/desktop/src/components/cursor/CursorModelEditor.tsx index e6be7e3..753858c 100644 --- a/apps/desktop/src/components/cursor/CursorModelEditor.tsx +++ b/apps/desktop/src/components/cursor/CursorModelEditor.tsx @@ -1,5 +1,5 @@ import type { ModelInput, Provider, ProviderInput, ProviderType } from "../../api"; -import { FormField, TextInput } from "../ui/FormControls"; +import { FormField, SecretTextInput, TextInput } from "../ui/FormControls"; import { Checkbox } from "../ui/Checkbox"; import { JsonEditor } from "../ui/JsonEditor"; import { Combobox, MultiCombobox, Select } from "../ui/Select"; @@ -72,7 +72,7 @@ export function CursorModelEditor({ draft, providers, editing, modelOptions, dis
{!editing && draft.providerMode === "new" && <> setProvider({ base_url: event.target.value })} /> - setProvider({ api_key: event.target.value })} /> + setProvider({ api_key: event.target.value })} /> } ; } +export function SecretTextInput({ className, ...props }: InputHTMLAttributes) { + const [visible, setVisible] = useState(false); + return
+ + +
; +} + export function FormField({ label, hint, className, children }: { label: string; hint?: string; className?: string; children: React.ReactNode }) { return