配置层: - Settings 新增 llm_provider/api_key/base_url/model/timeout/max_tokens - 生产 fail-closed: GAOKAO_LLM_PROVIDER=none 禁止, provider!=none 且 API key 为空禁止 - .env.docker.example / .env.payment.example 补 LLM 变量 - payment_readiness_doctor 将 LLM 配置纳入 readiness 检查 基础设施: - 新增 data/llm/client.py: OpenAI-compatible LLMClient - 新增 data/llm/prompts.py: audit/cwb/full_plan prompt 模板 - 新增 data/llm/tests/test_llm.py: 12 个单元测试 主链接入: - ReviewResultContract 新增 llm_generated / llm_summary / llm_cwb_suggestions - _start_review_result 优先尝试 LLM 生成审核结果, 失败时回退到原规则默认逻辑 - cwb 页面优先展示 LLM 生成的三档建议 测试适配: - conftest / health / app / p2_4 tests 注入默认 LLM 测试配置,避免被新 fail-closed 提前拦截 验证: - data/llm/tests 12 passed - 核心 prod settings tests 62 passed
21 lines
428 B
Python
21 lines
428 B
Python
"""LLM 集成模块。
|
|
|
|
支持 openai/dashscope/anthropic 三种供应商,通过统一的 OpenAI-compatible API 调用。
|
|
"""
|
|
|
|
from .client import LLMClient, LLMResponse, LLMError
|
|
from .prompts import (
|
|
build_audit_prompt,
|
|
build_cwb_prompt,
|
|
build_full_plan_prompt,
|
|
)
|
|
|
|
__all__ = [
|
|
"LLMClient",
|
|
"LLMResponse",
|
|
"LLMError",
|
|
"build_audit_prompt",
|
|
"build_cwb_prompt",
|
|
"build_full_plan_prompt",
|
|
]
|