fengsilin
|
87a0f94975
|
refactor: remove user-channel-ratio feature
删除用户渠道倍率(UserChannelRatio)功能,清理全链路相关代码:
后端删除 model/controller/router 层实现,前端删除 UI 组件和计费展示逻辑。
同时恢复 Token 分组选择和价格侧边栏分组过滤器的注释代码。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
1 周之前 |
fengsilin
|
9dbf3365fe
|
feat(pricing): 添加用户-模型-渠道倍率功能
为每个用户添加独立于全局定价的倍率乘数,支持按 (userId, model, channel) 三维
精确控制用户级别定价。倍率以乘法叠加在现有 modelRatio × groupRatio 之上。
- 新增 user_channel_ratios 表,写入内存缓存(写穿透模式)
- 新增 /api/user_channel_ratio/ CRUD API(AdminAuth)
- 计费路径集成:compatible_handler、PostClaudeConsumeQuota、
PostWssConsumeQuota、PostAudioConsumeQuota、calculateAudioQuota
- 前端:EditUserModal 内嵌 UserRatioSection 组件
- 修复 Update() 缓存 key 零值 bug(先加载再更新)
- 修复 PreWssConsumeQuota 缺少 UserChannelRatio 导致归零
- 修复 ModelPriceHelperPerCall 缺少默认值 1.0
Co-Authored-By: Claude <noreply@anthropic.com>
|
1 月之前 |
fengsilin
|
73d10b5799
|
feat: 错误日志记录上游 request-id 和响应体,Playground 渠道路由改为 header 传递
- 错误日志新增 upstream_request_id(从 Anthropic/OpenAI 响应 header 提取)和 upstream_body(截断 2KB)
- 修复 RelayErrorHandler 内部 WithOpenAIError/NewOpenAIError 分支丢失上游字段的 bug
- Playground 渠道和分组改为通过 X-Channel-Id/X-Group header 传递,而非 body 字段
- Distributor 中间件支持从 header 回退读取 channel_id 和 group
Co-Authored-By: Claude <noreply@anthropic.com>
|
1 月之前 |
fengsilin
|
00058cd671
|
refactor(channel-pricing): 提取辅助方法消除重复代码,修复缓存一致性
- 提取 PriceData.ApplyChannelPricingRatios 消除 ModelPriceHelper 和
UpdatePriceDataForChannelPricing 中重复的 ~30 行比率回退逻辑
- 提取 ChannelPricing.ApplyFields 消除 controller 中 4 处相同的字段赋值
- 提取 setCache/removeCache 辅助函数统一写穿透缓存操作
- 将 claudeCacheCreation1hMultiplier 常量移至 types 包避免循环依赖
- 修复 BatchUpsertChannelPricing 成功后未刷新内存缓存的 bug
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
1 月之前 |
fengsilin
|
044b5aafea
|
fix: 改进 RWMap JSON 加载原子性 & UI 文案调整
- types/rw_map.go: 解析失败时不再清空原有数据
- HomePricingFilters: 模型类型标签从"对话"改为"文本"
- makefile: docker-build 目标添加自动 push
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2 月之前 |
winter
|
08164cd0ae
|
fix
|
3 月之前 |