Skip to content
Merged
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
17 changes: 17 additions & 0 deletions src/renderer/components/SettingsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,12 @@ export function SettingsPanel({ onClose, initialTab }: SettingsPanelProps) {
} else {
await deleteKeychainSecret("anthropicApiKey");
}
// Forward to the sidecar's in-memory secrets store so the next
// Anthropic call this session picks up the new key. Without this,
// the keychain has it but the sidecar's getSecret() returns the
// pre-change value until the app restarts (which re-bootstraps
// secrets from the keychain at boot).
await window.api.settings.set({ anthropicApiKey: trimmed });
queryClient.invalidateQueries({ queryKey: ["general-config"] });
setApiKeySaved(true);
setTimeout(() => setApiKeySaved(false), 3000);
Expand Down Expand Up @@ -748,6 +754,17 @@ export function SettingsPanel({ onClose, initialTab }: SettingsPanelProps) {
setOpenRouterError(err instanceof Error ? err.message : "Save failed");
return;
}
// Forward to the sidecar's in-memory secrets store. The keychain
// is the canonical store (re-bootstrapped at app boot), but the
// sidecar caches the key in memory for the current session —
// without this call, OpenRouter requests this session see the
// stale value (or null) and fail with "API key not set" until
// the user restarts the app.
if (trimmed) {
await window.api.openrouter.setApiKey(trimmed);
} else {
await window.api.openrouter.clearApiKey();
}
setOpenRouterConfigured(!!trimmed);
setOpenRouterSaved(true);
setTimeout(() => setOpenRouterSaved(false), 3000);
Expand Down
Loading