feat(backend): AI 服务层 — 千问流式 LLM + 月报解析 + 健康度计算 + 风险检测 + Copilot
- LLM 客户端:全部 SSE 流式输出,兼容 OpenAI 接口
- AI 月报解析:SSE 流式端点 POST /reports/{id}/parse
- 健康度计算引擎:四维评分(财务/经营/AI商业化/AI成本)
- 风险自动检测引擎:6 条规则自动检测指标越界
- AI Copilot:SSE 流式对话 POST /copilot/chat
- 权限中间件:角色级 + 字段级权限控制
- 测试:21 个新测试(健康度 8 + 风险检测 8 + 权限 5),总计 64 passed
This commit is contained in:
@@ -26,9 +26,11 @@ class Settings(BaseSettings):
|
||||
jwt_access_token_ttl_minutes: int = 120
|
||||
jwt_refresh_token_ttl_days: int = 7
|
||||
|
||||
# AI / Ollama
|
||||
ollama_base_url: str = "http://localhost:11434"
|
||||
ollama_model: str = "qwen2.5:7b"
|
||||
# AI / LLM(千问 DashScope OpenAI 兼容模式)
|
||||
llm_api_key: str = ""
|
||||
llm_base_url: str = "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||
llm_model: str = "qwen-plus"
|
||||
llm_timeout_seconds: int = 60
|
||||
|
||||
model_config = {"env_file": ".env", "env_file_encoding": "utf-8"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user