7ec4fb0747
- LLM 客户端:全部 SSE 流式输出,兼容 OpenAI 接口
- AI 月报解析:SSE 流式端点 POST /reports/{id}/parse
- 健康度计算引擎:四维评分(财务/经营/AI商业化/AI成本)
- 风险自动检测引擎:6 条规则自动检测指标越界
- AI Copilot:SSE 流式对话 POST /copilot/chat
- 权限中间件:角色级 + 字段级权限控制
- 测试:21 个新测试(健康度 8 + 风险检测 8 + 权限 5),总计 64 passed
39 lines
980 B
Python
39 lines
980 B
Python
"""应用配置。
|
|
|
|
从环境变量读取配置,支持 .env 文件。
|
|
"""
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""应用配置,从环境变量读取。"""
|
|
|
|
# 应用
|
|
app_env: str = "development"
|
|
app_debug: bool = True
|
|
app_log_level: str = "info"
|
|
|
|
# 数据库
|
|
database_url: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/aiportpilot"
|
|
|
|
# Redis
|
|
redis_url: str = "redis://localhost:6379/0"
|
|
|
|
# JWT
|
|
jwt_secret_key: str = "change-me-in-production"
|
|
jwt_algorithm: str = "HS256"
|
|
jwt_access_token_ttl_minutes: int = 120
|
|
jwt_refresh_token_ttl_days: int = 7
|
|
|
|
# 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"}
|
|
|
|
|
|
settings = Settings()
|