Commit Graph
72 Commits
Author SHA1 Message Date
19904408334 e78b914b0b feat: 新增错误重试记忆表/entity/consts 2026-09-01 10:19:58 +08:00
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 b663149977 docs: 计划Task2测试修正(请求ID长度一致)+spec§3调用方式对齐独立15s client 2026-09-01 10:16:52 +08:00
19904408334 e5f205e6e1 docs: 模型错误LLM分析重试+持久记忆 实现计划 2026-09-01 10:14:42 +08:00
19904408334andClaude Code 49c1cb1f42 docs: 新增模型错误 LLM 分析重试 + 持久记忆设计 spec
- 固定错误码清单改为对话模型分析判定重试
- 持久化错误→结论知识库(PostgreSQL),命中记忆不再调模型
- 覆盖同步/流式/异步任务启动三路

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-01 10:06:40 +08:00
19904408334 db91d098bf chore: 删除过时的 model_resolve_test.go
引用功能单测(5 个)由用户确认不再需要, 单独提交删除
2026-08-29 17:53:35 +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
19904408334 7dcfb6744d fix: 引用行查询 Get 合入系统模型配置返回
引用行(ref_system_model_id>0)在 DB 只存个人字段(apiKey/enabled/chatModel),
Get 之前返回空配置,前端编辑表单无法补全。新增 mergeReferenceConfigForQuery:
以引用行身份字段为基底,把系统行配置列合入返回(不替换 {apiKey} 占位、
不做 enabled AND 门禁,区别于调用时 mergeReferenceConfig)。
保留引用行自身 id,Update/Delete 仍命中引用行。
2026-08-29 16:59:05 +08:00
19904408334andClaude b165ef4f3e refactor: 引用系统模型并入 Update,删除 /referenceSystemModel 端点
非超管 updateModelManage 编辑系统模型时直接插引用行(apiKey 必填、同名唯一、
不拷贝配置),前端继续走 updateModelManage 即可引用,无需换接口。

- 删 service.ReferenceSystemModel / controller.ReferenceModel / ReferenceSystemModelReq/Res
- Update:恢复引用行(refSystemModelId>0)个人字段分支(只改 apiKey/enabled/chatModel)
- 修复同名唯一性检查丢失自排除(exist.Id != req.Id),允许不改名编辑
- 非超管建引用行补 apiKey 必填校验

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 16:46:24 +08:00
19904408334andClaude 58d9891205 chore: 存量拷贝转引用迁移 SQL
按同名系统模型把存量拷贝行转引用行(配置列清空、幂等、ref_system_model_id 守卫)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 14:39:18 +08:00
19904408334andClaude 6cff7a934b feat: 系统模型被引用拒删,系统 apiKey 对非创建者脱敏
- Delete:系统模型被引用 → 拒绝;引用行/自有行仅创建者可删
- List/Get:系统模型 apiKey 对非创建者返回空

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 14:38:49 +08:00
19904408334andClaude c2758b3010 refactor: Update 删拷贝分支,引用行锁定配置,系统改名传播引用
- 引用行只改 apiKey/enabled/chatModel,配置锁定跟随系统模型
- 系统模型改名同步引用行 model_name(保列表去重正确)
- 非创建者操作他人行 → 无权限(引用改走 referenceSystemModel)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 14:38:25 +08:00
19904408334andClaude 66f1d1020f feat: 引用系统模型端点 referenceSystemModel
用户引用系统模型只存 apiKey/enabled/chatModel,配置实时跟随系统模型(不拷贝)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 14:37:48 +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 bc78ad2b2f feat: 模型引用解析层 resolveModelConfig + {apiKey} 占位替换
- resolveModelConfig:引用行实时取系统行配置+本人 apiKey,Id 覆盖为系统模型 id
- mergeReferenceConfig 纯函数:配置取系统行,个人字段取引用行,enabled 取 AND
- substituteAPIPlaceholder 非破坏式替换(BaseURL/头/体/业务字段/异步映射)
- 纯函数单测 4 个全过(service 包测试需临时 config.yml 兜底)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 14:36:35 +08:00
19904408334andClaude 4afb920456 feat: model_manage 增加 ref_system_model_id 引用列与引用 DTO
- entity/dto 落地 ref_system_model_id 字段 + ReferenceSystemModelReq/Res
- DAO 新增 CountReferences / UpdateReferencesName 辅助方法
- roundtrip 单测验证 DTO→entity 映射

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-29 14:35:12 +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 e079f4ea28 build(model-gateway): 升级 common 和 gmq 依赖版本 2026-08-26 14:56:31 +08:00
19904408334 657c53142c build: 移除未使用的 lib/pq 间接依赖 2026-08-22 11:25:46 +08:00
19904408334 174eb7cf27 fix: 流式调用失败时写入模型会话错误信息 2026-08-22 09:58:12 +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
admin 55c797dd96 项目初始化 2026-06-22 10:42:21 +08:00
WangLiZhao 445ee02c5a refactor(model): 重构模型网关实体和映射逻辑 2026-06-12 17:50:22 +08:00
WangLiZhao b3b111995e refactor(task): 重构任务服务和数据结构 2026-06-12 15:29:05 +08:00
WangLiZhao 1c6c9bae14 refactor(service): 重构模型网关服务结构 2026-06-11 17:58:49 +08:00
WangLiZhao afd60caf56 fix(task): 修复任务状态更新和超时处理问题 2026-06-11 11:27:14 +08:00
WangLiZhao 196d2069ac Merge remote-tracking branch 'origin/dev' into dev 2026-06-10 16:47:32 +08:00
WangLiZhao 7596cbde09 feat(task): 添加任务更新功能 2026-06-10 16:47:21 +08:00
admin 7ec18926e3 ci/cd调整 2026-06-10 16:24:29 +08:00
admin a6b32bfeb3 ci/cd调整 2026-06-10 16:16:05 +08:00
WangLiZhao 2dc88ae587 refactor(prompts-core): 重构代码结构和优化工具函数 2026-06-10 14:51:24 +08:00
WangLiZhao e906248b0a feat(session): 重构会话管理和Redis缓存机制 2026-06-09 14:00:00 +08:00
WangLiZhao e5781aca06 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	go.sum
2026-06-08 18:02:26 +08:00
WangLiZhao 0cf8948cd2 feat: 重构异步模型字段并更新依赖 2026-06-08 18:01:53 +08:00
admin 96e8bdfe62 ci/cd调整 2026-06-08 15:37:11 +08:00
admin 26de41d04e ci/cd调整 2026-06-08 13:44:54 +08:00
admin 0bee3685fb ci/cd调整 2026-06-08 13:39:20 +08:00
WangLiZhao 9049e0d2e8 refactor(prompt): 重构提示词构建服务和回调处理 2026-06-05 11:00:04 +08:00
WangLiZhao aae46a4f29 refactor(model-gateway): 重构代码结构并优化数据库查询 2026-06-03 18:37:17 +08:00
WangLiZhao bcfcc7ed47 refactor(util): 重构映射工具函数并优化异步任务轮询逻辑 2026-06-03 13:30:39 +08:00
WangLiZhao 2c7838807b chore(deps): 初始化项目依赖配置 2026-06-02 20:28:06 +08:00
WangLiZhao 52124385a1 refactor(asynch): 重构异步模型配置和队列管理 2026-06-02 20:26:45 +08:00
WangLiZhao c7e9eb889b feat(model): 添加流式配置支持并优化响应处理 2026-05-30 22:08:46 +08:00
19904408334 558fd49ec1 fix: 修复模型查询条件为空时的异常行为 2026-05-29 18:06:50 +08:00
WangLiZhao d409b84b58 refactor(service): 重构服务模块结构并优化模型配置 2026-05-29 17:54:19 +08:00
WangLiZhao e487b4bb5e refactor(task): 重构异步任务处理流程 2026-05-27 09:36:25 +08:00
WangLiZhao a28fcbaee9 feat: 新增模型扩展映射与查询配置字段 2026-05-23 18:08:08 +08:00