설정 저장: 빈 API 키/토큰 입력칸이 기존 vault 참조를 덮어쓰지 않도록(전체 저장 후 'Anthropic API key not configured' 방지)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1c17217473
commit
cca769d89f
1 file changed
+5
-2
@@ -310,8 +310,11 @@ export function registerSettingsRoutes(app: Express): void {
|
||||
for (const [provId, provConf] of Object.entries((llm.providers || {}) as Record<string, any>)) {
|
||||
const existing: Record<string, any> = storedProviders[provId] || {};
|
||||
const merged: Record<string, any> = { ...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;
|
||||
|
||||
Reference in new issue
Block a user