Files
life-echo/api/tests/test_llm_vendor_errors.py
Kevin 80833f7033 feat(api): DeepSeek V4 Flash 默认、HTTP 错讯与多供应商分层
- 主链路默认 deepseek-v4-flash,DEEPSEEK_THINKING_ENABLED 对齐旧非思考 chat
- 评测台评审装配迁入 adapters/llm(deepseek_eval_judge、zhipu_eval_judge)与 eval_judge_spec
- 拆分 llm_http_openai_chat_errors 与 llm_errors(DeepSeek/智谱品牌与文档链),llm_call 支持 http_error_vendor
- EvalJudgeService 按 spec.provider 传入 allm_json_call;评测台前端文案改为 V4 Flash
- 更新 .env 示例与 staging/production 的 DEEPSEEK_MODEL;补充 openai/供应商错讯测试

Made-with: Cursor
2026-04-27 14:34:30 +08:00

37 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""供应商层 HTTP 错讯DeepSeek / 智谱 品牌与文档链。"""
import httpx
from openai import APIStatusError
from app.core.llm_errors import format_llm_http_error_message
def _status_402() -> APIStatusError:
req = httpx.Request("POST", "https://x/v1/chat/completions")
resp = httpx.Response(402, request=req, json={"error": {"message": "x"}})
return APIStatusError("u", response=resp, body=resp.json())
def test_vendor_deepseek_includes_brand_and_doc() -> None:
e = _status_402()
m = format_llm_http_error_message(e, "deepseek")
assert m is not None
assert "DeepSeek" in m
assert "api-docs.deepseek.com" in m
def test_vendor_zhipu_includes_brand_and_doc() -> None:
e = _status_402()
m = format_llm_http_error_message(e, "zhipu")
assert m is not None
assert "智谱" in m
assert "bigmodel" in m
def test_vendor_none_is_transport_only() -> None:
e = _status_402()
m = format_llm_http_error_message(e, None)
assert m is not None
assert "" not in m
assert "402" in m