tokenFactory/.codebuddy/memory/2026-05-28.md

2.0 KiB
Raw Blame History

2026-05-28

Docker 构建 & 部署

  • 项目使用多阶段 Docker 构建(bun前端 → golang后端 → debian运行时)
  • 国内构建需要添加 ENV GOPROXY=https://goproxy.cn,direct 到 Dockerfile builder2 阶段
  • docker-compose.yml 中 image 需改为本地镜像名 token-factory:latest 才能使用自建镜像

代码修复

  • ModelTagModelTestResult 未加入 AutoMigrate 列表,导致 model_tagsmodel_test_results 表缺失
    • 已在 model/main.go 的 migrateDB()migrateDBFast() 两处添加
  • Dockerfile 中添加了 GOPROXY=goproxy.cn 解决国内网络无法访问 proxy.golang.org 的问题

模型广场数据链路分析

  • GET /api/pricing 3层过滤: abilities(enabled) → ModelHasConfiguredPricing(倍率/价格表) → BuildPricingAPIItems(渠道+单测门禁)
  • 模型名必须与 ModelRatio/ModelPrice 中的 key 精确匹配(区分大小写)
  • 模型广场需: home_page_content为空 + abilities有记录 + 倍率表有配置 + models表status=1 + 单测通过
  • 设置页面仅 Root 用户(role=100)可见Admin(role=10)不可见
  • 倍率配置在: 设置 → 分组与模型定价设置RatioSetting组件

DeepSeek 模型配置

  • 渠道名为"DeepSeek",实际模型名为 deepseek-v4-flashdeepseek-v4-pro
  • ModelRatio 中只有 DeepSeek(大写),缺少 deepseek-v4-flashdeepseek-v4-pro
  • 已通过 SQL 在 ModelRatio 中添加这两个模型名的倍率配置

单测门禁问题(核心阻断)

  • model_test_results 表不存在时,BuildPricingAPIItemstestMs 永远为0
  • 第264行: if !includeUntestedChannelPricingRows && testMs <= 0 { continue } 跳过所有条目
  • 即使 LoadChannelPricingTestSuccessIndex 对空表返回空map不报错testMs<=0 门禁仍阻断
  • 解决方案: 手动创建表并插入测试记录,或在管理后台执行渠道测试
  • 已通过 SQL 创建 model_test_results 表并插入 deepseek 渠道的两条测试记录testMs=500/800