diff --git a/src/gateway/routes/settings.ts b/src/gateway/routes/settings.ts index b25be4e..5824b1e 100644 --- a/src/gateway/routes/settings.ts +++ b/src/gateway/routes/settings.ts @@ -310,8 +310,11 @@ export function registerSettingsRoutes(app: Express): void { for (const [provId, provConf] of Object.entries((llm.providers || {}) as Record)) { const existing: Record = storedProviders[provId] || {}; const merged: Record = { ...existing, ...provConf }; - if ((provConf as any)?.api_key === '••••••••' && existing.api_key) merged.api_key = existing.api_key; - if ((provConf as any)?.token === '••••••••' && existing.token) merged.token = existing.token; + // 마스크('••••••••')뿐 아니라 빈 값도 "바꾸지 않음"으로 본다 — 전체 저장 때 화면이 비어 있는 키 입력칸을 그대로 보내 + // vault 참조(vault:anthropic.api_key)를 ''로 덮어 쓰면 서버가 "API key not configured"로 멎는다(2026-10-20). + const keepSecret = (v: any) => v === '••••••••' || v === '' || v === undefined || v === null; + if (keepSecret((provConf as any)?.api_key) && existing.api_key) merged.api_key = existing.api_key; + if (keepSecret((provConf as any)?.token) && existing.token) merged.token = existing.token; if (!(provConf as any)?.model && existing.model) merged.model = existing.model; if (!(provConf as any)?.endpoint && existing.endpoint) merged.endpoint = existing.endpoint; mergedProviders[provId] = merged;