default.yaml 3.37 KB
# LLM Call Platform - 默认配置
# 作用:所有环境的基准配置,可被环境特定配置覆盖
# 格式:YAML
# 覆盖优先级:环境变量 > 生产配置 > 开发配置 > 默认配置

app:
  name: "LLM Call Platform"
  version: "1.0.0"
  host: "0.0.0.0"
  port: 8011

database:
  # 数据库连接信息,推荐通过环境变量 LLMCP_DB_* 覆盖
  host: "localhost"
  port: 3306
  name: "llm_call_platform"
  # charset: utf8mb4  # 固定值,不支持修改
  pool_size: 10
  max_overflow: 20

jwt:
  # JWT 密钥,生产环境必须通过环境变量 LLMCP_JWT_SECRET_KEY 覆盖
  secret_key: "change-me-in-production"
  algorithm: "HS256"
  expiration_minutes: 1440  # 24 小时

encryption:
  # API Key 加密密钥,生产环境必须通过环境变量 LLMCP_ENCRYPTION_KEY 覆盖
  # 要求:长度 >= 32 字符
  key: "change-me-in-production-must-be-32-bytes-long!"

logging:
  level: "INFO"  # DEBUG/INFO/WARN/ERROR
  format: "%(asctime)s [%(levelname)s] %(name)s: %(message)s"

celery:
  broker_url: "redis://localhost:6379/0"
  result_backend: "redis://localhost:6379/1"
  task_serializer: "json"
  result_serializer: "json"
  accept_content: ["json"]
  timezone: "Asia/Shanghai"
  enable_utc: false
  task_track_started: true
  task_acks_late: true
  worker_prefetch_multiplier: 1
  task_soft_time_limit: 300
  task_time_limit: 600
  max_retries: 3
  retry_delay: 10

  beat_schedule:
    rescan_async_tasks:
      task: "app.tasks.llm_tasks.rescan_stuck_tasks"
      schedule: 300.0  # 每 5 分钟扫描一次
    archive_expired_logs:
      task: "app.tasks.llm_tasks.archive_expired_logs"
      schedule: 86400.0  # 每天运行一次
    aggregate_call_stats_hourly:
      task: "app.tasks.llm_tasks.aggregate_call_stats"
      schedule: 3600.0  # 每小时运行一次

log_storage:
  # 原始日志文件存储路径,支持相对路径(相对项目根目录)和绝对路径
  path: "./logs"
  # 日志保留天数,超过此天数的日志将归档清理
  retention_days: 30

# ============ 代码定义优先的供应商配置 ============
# 作用:定义系统支持的模型供应商列表
# 配置结构对应 ModelProvider 表的字段
# 执行 POST /api/v1/providers/sync 时将此处配置同步到数据库
# 废弃的供应商从配置中移除即可,同步时会自动停用(status=disabled)
# 当前仅保留通义千问,如需添加其他供应商在此处追加
providers:
  - provider_name: "qwen"
    display_name: "通义千问"
    adapter_type: "qwen"
    supported_models:
      - "qwen-turbo"
      - "qwen-plus"
      - "qwen-max"
      - "qwen-vl-plus"
    supported_template_types:
      - "general"
      - "image"
      - "param_text"
    default_model: "qwen-plus"
    description: "阿里云通义千问系列大语言模型(通过百炼 SDK 直接调用)"
  - provider_name: "dashscope"
    display_name: "阿里云 DashScope"
    adapter_type: "openai_compat"
    supported_models:
      - "qwen-plus"
      - "qwen-turbo"
      - "qwen-max"
      - "qwen-long"
      - "qwen3-plus"
      - "qwen3-turbo"
      - "qwen3-max"
      - "qwen3-235b-a22b"
      - "qwen-vl-plus"
      - "qwen3-vl-plus"
    supported_template_types:
      - "general"
      - "image"
      - "param_text"
    default_model: "qwen-plus"
    description: "阿里云百炼平台 DashScope 服务,兼容 OpenAI API 格式。base_url: https://dashscope.aliyuncs.com/compatible-mode/v1"