fix: 诊断提速与稳定性修复(reasoning 2048→512、输出精简、上限16000→8000、loading提示、观测日志+配置错误可读)

This commit is contained in:
LuminousRuoxi
2026-08-25 13:21:49 +08:00
parent d6f70b02f4
commit c04b6a0fd0
6 changed files with 70 additions and 11 deletions
+9 -1
View File
@@ -113,10 +113,18 @@ def test_reasoning_config_does_not_set_effort_and_max_tokens():
retry = reasoning_config(True)
assert not ("effort" in first and "max_tokens" in first)
assert not ("effort" in retry and "max_tokens" in retry)
assert first == {"max_tokens": 2048}
assert first == {"max_tokens": 512}
assert retry == {"effort": "none", "exclude": True}
def test_bad_proxy_url_raises_readable_llm_error():
# 代理 URL 带变量名前缀(如 .env 解析出错)→ httpx 构造期 ValueError
# 必须转可读 LLMError,不能裸 5002026-08-25 实测事故,见 llm.py 注释)
c = LlmClient(api_key="test-key", proxy="PRODREAM_BACKEND_OPENROUTER_PROXY_URL=http://x:1@h:2")
with pytest.raises(LLMError, match="配置错误"):
c._complete("system", "user")
def test_message_text_empty_mentions_finish_reason():
with pytest.raises(LLMError, match="finish_reason=length"):
message_text(