fix(settings): let a saved AI API key be removed

Every personal provider form showed a stored key and offered no way to
take it back, since saving with an empty key field keeps the stored one.
The OpenAI, Anthropic, local model and gateway forms now carry a
confirmed "Remove API key" while a key is stored. It sends the existing
PATCH /api/user/ai-provider with that one key as null, which clears the
column and leaves the provider choice, model and the other keys alone.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 12:36:14 +02:00
1 parent 41cf584a65
commit 6037ebd3d6
16 files changed
+431

No files matched your search

@@ -137,6 +137,21 @@ const REGISTRY: DestructiveEntry[] = [
recovery: "permanent",
confirm: ["AlertDialog"],
},
{
file: "components/settings/ai/remove-saved-key-button.tsx",
destroys:
"one stored personal AI provider key (OpenAI, Anthropic, the local model or the gateway); the provider choice and model stay",
triggers: [
"components/settings/ai/openai-provider-form.tsx",
"components/settings/ai/anthropic-provider-form.tsx",
"components/settings/ai/local-provider-form.tsx",
"components/settings/ai/compat-provider-form.tsx",
],
recovery: "permanent",
confirm: ["ConfirmButton"],
undetected:
"No detector sees it. The body comes from `removeSavedKeyBody` with a computed key (`{ [field]: null }`), which the D3 literal pattern does not match, and `/api/user/ai-provider` names no act. Registered by hand.",
},
{
file: "components/settings/api-section.tsx",
destroys: "an API token — revoked, and the secret is never shown again",