fix(llm): get_masked_config 畸形 env timeout 降级默认——视图字典 float() 二次解析曾裸抛 ValueError 击穿 resolved=False 语义(GET 变 500);降级 60.0 与 resolve_config 默认一致+测试钉死 [vps] [no-doc]

This commit is contained in:
2026-10-05 09:23:01 +08:00
parent ddfedd13fd
commit d22feae2a8
2 changed files with 16 additions and 1 deletions
+5 -1
View File
@@ -93,11 +93,15 @@ def get_masked_config(path: str,
resolved, missing = True, []
except LLMConfigError as e:
resolved, missing = False, [str(e)]
try:
timeout_num = float(timeout)
except ValueError:
timeout_num = 60.0 # 畸形 env timeout 降级默认,视图仍出 resolved=False
return {
"config": {"provider": provider, "base_url": base_url,
"model": model,
"api_key": mask_secret(api_key) if api_key else "",
"timeout": float(timeout),
"timeout": timeout_num,
"enabled": ov.get("enabled") not in ("0", "false", "False")},
"sources": {"provider": p_src, "base_url": b_src, "model": m_src,
"api_key": k_src, "timeout": t_src,