Commit Graph
8 Commits
Author SHA1 Message Date
19904408334 1ca25abca0 refactor: 模型解析/价格工具拆分至 service/utils,调用方适配(WIP)
- price.go -> service/utils/media_type.go(媒体类型检测)
- model_resolve.go -> service/utils/model_resolve.go(模型解析)
- 删除 service/parse_error_test.go(逻辑迁往 utils 后无对应测试)
- session_sync/session_stream/model_*_service/pricing_client 等调用方适配
- schema_mapping/model_call_dto 补字段路径
2026-09-01 10:18:23 +08:00
19904408334 923644db2b refactor: 模型错误解析改为 ErrorMessageMapping 配置驱动
- parseModelError 按模型配置的 ErrorMessageMapping(schema 树)解析错误响应
- 成功判定: code 提取为空 / code 节点配置 defaultValue 且提取值等于它 → 成功
- 未配置 mapping 不识别错误(纯配置驱动), 删硬编码 ModelErrorResp/ModelError1Resp
- DTO 加 errorMessageMapping 字段, update.sql 建 error_message_mapping JSONB 列
- 单测: parse_error_test.go 覆盖扁平/嵌套/数组/纯字符串路径/未配置/坏 JSON
2026-08-29 17:52:23 +08:00
19904408334andClaude b99f43b31f feat: 调用链接入引用解析,计价按系统模型 id
- ModelCall/ModelCallStream:GetNotTenantId 后 resolveModelConfig,modelBillable 改 modelInfo.Id
- 异步 task_end:轮询/计价用解析后系统模型配置,calcModelCost 改 modelInfo.Id

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 14:37:15 +08:00
19904408334andClaude 928682f121 feat: 模型计费收敛到 shop-user-trade(去 admin 租户扣费 + /calc 算费)
- 删 CheckTenantBalance/DeductBalance/GetTenantSurplus(admin-go 租户余额退出 model-gateway)
- 新增 pricing_client.go:门禁 config/get + calcModelCost 调 shop-user-trade /calc 算费
- sync/stream/async 三处 Cost 改为按用量调 /calc(媒体类型映射 text/audio/video/image)
- 删 price.go 本地 PriceConfig 换算体系与 entity/dto 的 price_config 字段

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 14:32:51 +08:00
19904408334 4a9ae2d412 refactor: 重构模型 HTTP 客户端并移除冗余代码 2026-08-29 11:53:02 +08:00
19904408334 cb9d04648c fix: 确保任务结束释放 Redis 锁
将 Redis 锁的删除从成功路径移动到 defer,保证任务无论成功失败都会释放锁,避免失败时残留锁导致任务在 TTL 内无法被重新获取。
2026-08-22 08:26:43 +08:00
19904408334 9d9bd71468 fix: 优化模型网关请求重试与业务字段前置写入
- 流式调用增加可重试错误码检测与指数退避重试
- 业务字段写入改为前置追加,不覆盖已有值
- 请求体按模板元数据递归合并,补充数组/对象字段处理
- 异步任务查询支持请求体映射与占位符替换
- 升级 common 与 gmq 依赖版本,移除本地 replace
2026-08-21 09:47:21 +08:00
19904408334 76c55fbb73 feat: 新增业务字段路径读写工具
新增 TakeBusinessFields、WriteBusinessFields、SetByPath 与 GetByPath 等工具,支持按映射路径写入请求体与解析响应,并更新相关依赖。
2026-08-18 10:11:09 +08:00