fengsilin
12686067c5
feat(volcengine): serve native /api/v3 video path on official DoubaoVideo channels
The native /api/v3/contents/generations/tasks route was restricted to
the seedance asset channel family (58/60/61); official Volcengine Ark
channels (DoubaoVideo, type 54) could only be reached via the
standardized /v1/video/generations path. Allow type 54 on the native
route in both the distributor and the task retry channel selection,
while keeping it out of the seedance asset binding system.
The taskdoubao adaptor now reuses a pre-parsed task request from the
context (native path) instead of re-parsing the body as TaskSubmitReq,
whose prompt validation would reject the Volcengine-native format.
When req.Prompt is empty (native path), content text items from
metadata are preserved instead of being replaced with an empty prompt;
the standardized path behavior (prompt replaces metadata text) is
unchanged and covered by existing tests.
Co-Authored-By: ZCode <noreply@anthropic.com>
преди 1 седмица
fengsilin
17c12fd41e
feat: harden services and add video channel bindings
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
cd35e66b33
feat(chinamobile): add channel asset credentials
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
50ce4f7541
feat(tianyiyun): add Seedance asset support
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
c67d8c409e
feat(chinamobile): add Seedance channel and isolated asset library
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
fcb1c2a8ba
fix: prevent webhook bypass via empty secret and cross-gateway callback attacks
Add two layers of defense:
1. Webhook availability guard (controller/payment_webhook_availability.go):
- isStripeWebhookEnabled() checks StripeWebhookSecret != "" before processing
- isCreemWebhookEnabled(), isWechatPayWebhookEnabled(), isAlipayWebhookEnabled()
- isEpayWebhookEnabled() with similar checks for all payment webhooks
- Applied to: StripeWebhook, CreemWebhook, WechatPayWebhook, AlipayPayWebhook,
EpayNotify, SubscriptionEpayNotify
2. PaymentProvider field (model/topup.go):
- New PaymentProvider field on TopUp to identify which gateway created the order
- Recharge() checks PaymentProvider == PaymentProviderStripe
- rechargeByQRCodePayment() checks PaymentProvider matches wechat/alipay
- RechargeCreem() checks PaymentProvider == PaymentProviderCreem
- All payment controllers set PaymentProvider when creating orders
Root cause: When StripeWebhookSecret was empty, ComputeSignature used
an empty HMAC key, allowing attackers to forge valid signatures and
complete orders from any payment gateway without actually paying.
Co-Authored-By: Claude <noreply@anthropic.com>
преди 1 месец
fengsilin
bde79b7259
fix(kling): persist proxy fallback asset binding
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
f6321b3910
feat(channel): support dynamic video asset channel selection
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
3fbf48313a
feat(pricing): support usage billing and endpoint fixes
Add KlingAiping usage-token settlement from upstream final_unit_deduction and duration fallback handling.
Normalize model endpoint config persistence and convert model pricing values between stored USD and display currency in the editor.
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
678add297f
feat(channel): add tianyiyun seedance channel
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
49ca8a6ae7
fix(kling): 修复原生路由和展示价格保存
- 避免仅编辑展示价格时写入默认真实计费规则
- 将 video-extend 纳入 KlingAiping 原生渠道约束
- 补充相关保存决策、渠道约束和计费展示测试
Co-Authored-By: Codex <noreply@anthropic.com>
преди 1 месец
fengsilin
6f805a6177
refactor: update aiping doubao upstream API paths to multimodal/sd endpoints
- Asset: /api/v1/volcengine/asset → /api/v1/multimodal/sd/assets
- Create video task: /api/v1/videos → /api/v1/multimodal/sd/videos/contents/generations/tasks
- Query video task: /api/v1/videos/{id} → /api/v1/multimodal/sd/videos/contents/generations/tasks/{id}
Co-Authored-By: Claude <noreply@anthropic.com>
преди 1 месец
fengsilin
56400b6c61
feat: KlingAiping 渠道适配 + 展示价格管理后台
- 新增 KlingAiping 渠道 (ChannelTypeKlingAiping = 59)
- 新增 KlingAiping 原生路由 (text2video/image2video/omni-video 等)
- 新增 KlingAiping adaptor (relay/channel/task/kling/aiping/)
- 前端模型定价页面新增「真实计费 / 展示价格」Tab 切换
- 新增 DisplayPricing 组件,支持模型展示价格的增删改
- 新增 displayPricingConfig 工具函数及测试
- 修复 KlingAiping 路由路径匹配与 task 错误响应
Co-Authored-By: Claude <noreply@anthropic.com>
преди 1 месец
fengsilin
ced4d7f323
feat: expose model display pricing
преди 1 месец
fengsilin
de117ac932
feat: add model display pricing admin api
преди 1 месец
fengsilin
c9988af52b
feat: 用户创建同步到从节点及 i18n 翻译
新建用户时异步同步到海外 slave 节点,确保跨区域用户数据一致。
补充前两个 commit 全部新功能的中英文翻译字符串。
Co-Authored-By: Claude <noreply@anthropic.com>
преди 2 месеца
fengsilin
84d364d76a
feat: 使用日志计费详情展开与 completion_tokens 修复
前端新增 UsageLogExpandedDetail 点击展开面板和 BillingDetailSummary
hover 计费详情,后端修复 per_1m_tokens 任务结算日志的 completion_tokens
从零值改为写入 total_tokens 实际值。新增 taskBillingLogMerge 合并
任务预扣/结算日志。
Co-Authored-By: Claude <noreply@anthropic.com>
преди 2 месеца
fengsilin
2e40bab478
feat: 模型定价矩阵价格取中位数展示
前端模型定价配置 UI 增强(Editor/GeneratorModal/PreviewPanel/PricingGrid),
后端新增 representativeMatrixPrice 取矩阵定价表中位数作为展示价格,
替代原来的 model_price=0 导致的价格展示为空问题。
Co-Authored-By: Claude <noreply@anthropic.com>
преди 2 месеца
fengsilin
696c549a66
feat(video): add doubao aiping video pricing support
Co-Authored-By: Codex <noreply@anthropic.com>
преди 2 месеца
fengsilin
3ac94e2e6f
test(task-pricing): cover model pricing api and remix snapshots
преди 2 месеца
fengsilin
285323d765
feat(task-pricing): expose model pricing rules api
преди 2 месеца
fengsilin
3a52f31608
feat(task-pricing): gate channels for matrix usage billing
преди 2 месеца
fengsilin
db8eacd558
feat(task-pricing): persist matrix billing snapshots
преди 2 месеца
fengsilin
8f89828ca3
fix(user-migration): 禁止冲突用户非法合并
- 前端冲突处理页面禁用 cn_already_synced_to_ov 场景的 merge 操作
- 后端 resolve 接口拒绝将已存在 synced copy 的 CN 用户作为 merge 目标
- 补充对应控制器测试
Co-Authored-By: Codex <noreply@anthropic.com>
преди 2 месеца
fengsilin
65e6a82d34
feat(user-migration): support selective batches and cancellation
Add candidate user selection and explicit_ids batch creation flow for overseas migration. Also add cancellable batches to release selected-user locks and extend backend, frontend, and e2e coverage for the new flow.
Co-Authored-By: Codex <noreply@anthropic.com>
преди 2 месеца
fengsilin
ca3f8765bb
test(user-migration): complete migration coverage and e2e flow
Co-Authored-By: Codex <noreply@anthropic.com>
преди 2 месеца
fengsilin
e9d5d51b37
fix(sync): 修复 Slave 端编辑同步用户时误报余额不可修改的问题
前端对同步用户用 SyncedQuota 替代 Quota 展示,但后端比较时
用的是数据库真实 Quota 字段,导致两者不同而触发拦截。
改为比较 SyncedQuota,只有真正修改额度时才拦截。
преди 2 месеца
fengsilin
3a78e9c93a
fix(user-migration): revalidate drift and verify synced quota
преди 2 месеца
fengsilin
36b47379f7
test(user-migration): cover rescan and batch status regressions
преди 2 месеца
fengsilin
7282142316
feat(user-migration): add root admin migration API
преди 2 месеца
fengsilin
102b15ad41
feat(user-migration): add internal migration endpoints and client
преди 2 месеца
fengsilin
87a0f94975
refactor: remove user-channel-ratio feature
删除用户渠道倍率(UserChannelRatio)功能,清理全链路相关代码:
后端删除 model/controller/router 层实现,前端删除 UI 组件和计费展示逻辑。
同时恢复 Token 分组选择和价格侧边栏分组过滤器的注释代码。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
преди 2 месеца
fengsilin
23f9ed4ccd
fix(redemption): block synced users from redeeming
Reject redemption requests from synced users, surface a localized API message, and cover both model- and controller-level paths with tests.
Co-Authored-By: Codex <noreply@anthropic.com>
преди 2 месеца
fengsilin
2af3a9301d
fix(pricing): remove stale channel pricing backend
Delete leftover channel pricing controllers and routes after removing channel pricing, and align relay price helpers with global pricing plus user channel ratio only.
Co-Authored-By: Codex <noreply@anthropic.com>
преди 2 месеца
fengsilin
7ecedd8e57
fix: restore clean go test baseline
преди 2 месеца
fengsilin
1c5e6d03d9
fix: 禁止修改同步用户余额
同步用户余额由主节点管理,从节点不应允许管理员修改其余额。
前端禁用额度输入和添加额度按钮,后端增加校验拦截。
преди 3 месеца
fengsilin
fe62509b03
feat(metrics): 重试循环和错误处理中采集指标
преди 3 месеца
fengsilin
c64afdc6c2
fix: 清理渠道选择删除后的代码质量问题
- router/api-router.go: 修复删除路由后的缩进异常
- model/channel_pricing.go: 清理 Insert/Update/Delete 中遗留空行
- controller/relay_test.go: newTestContext 接收 *testing.T 参数并调用 t.Helper()
преди 3 месеца
fengsilin
631e030411
test: 添加渠道选择功能删除后的验证测试
验证 parseTokenKey 不再解析 channelId(sk-abc123:42 中的 :42
保留为 key 一部分),shouldRetry/shouldRetryTaskRelay 不再检查
specific_channel_id,所有请求都能正常重试。
преди 3 месеца
fengsilin
baed9754d0
refactor: 完整删除渠道选择功能后端代码
删除了用户通过 sk-{key}:{channelId} 指定渠道、Playground 下拉框选择渠道、
以及管理员设置默认渠道 (is_default) 的所有后端代码。
涉及修改:
- middleware/auth.go: 简化 parseTokenKey,移除 specific_channel_id 设置
- middleware/distributor.go: 移除指定渠道分发逻辑、默认通道检查、ModelRequest.ChannelId
- constant/context_key.go: 移除 ContextKeyTokenSpecificChannelId
- controller/playground_channels.go: 整个文件删除
- controller/relay.go: 移除 shouldRetry/shouldRetryTaskRelay 中的指定渠道跳过
- controller/channel.go: 移除 GetUserChannelsForBinding
- controller/channel_pricing.go: 移除 SetDefaultChannel/ClearDefaultChannel
- model/ability.go: 移除 GetModelChannelsForGroup
- model/channel.go: 移除 GetAllChannelsForBinding
- model/channel_pricing.go: 移除默认通道缓存及所有相关函数
- model/pricing.go: 移除 DefaultChannelName 字段
- router/api-router.go: 移除 4 条路由
- i18n: 移除 channel.id_format_error 和 distributor.invalid_channel_id
преди 3 месеца
fengsilin
714d8239d1
feat: Relay 请求抓包日志 + 用户模型 RPM 限流
两个独立功能:
1. Relay Capture:对开启 capture_relay 的用户记录完整请求/响应到本地文件
- 单 writer goroutine + 128 槽 channel 架构,无 OOM 风险
- 支持流式 SSE 和非流式请求
- 30s 超时保护
2. User-Model RPM Rate Limiting:按 用户+模型 维度的 RPM 限流
- Redis 令牌桶 + 内存滑动窗口双路径,Redis 故障自动降级
- 请求失败时退还令牌/配额(Redis Refund Lua 脚本 + 内存 Refund)
- Redis pipeline 错误处理:失败时清理缓存 key
- 前端用户编辑弹窗新增模型限流配置面板
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
преди 3 месеца
fengsilin
e6b4a06557
feat(logs): 隐藏使用日志中的分组信息展示
使用注释方式隐藏分组列和分组倍率标签,便于后续恢复:
1. 注释 UsageLogsColumnDefs.jsx 中的分组列定义
2. 注释 useUsageLogsData.jsx 中的 COLUMN_KEYS.GROUP 和默认可见性配置
3. 将计费详情中的"分组倍率"改为"倍率"
后端计费逻辑不变,仍正常应用分组倍率。
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
преди 3 месеца
fengsilin
f7ff684d0d
feat(pricing): 渠道定价展示用户折扣价格
登录用户查看渠道定价时,按用户分组倍率和渠道个人倍率计算实际折扣价
并在价格列展示划线原价与折扣价,新增 /pricing/user/*model 接口。
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
преди 3 месеца
fengsilin
e1b6aff7e1
fix(log): 对普通用户隐藏 Chat ID 和 Upstream ID
后端 GetUserLogs 返回前清空 chat_id/upstream_id(omitempty 不输出),
前端搜索框和展开行详情加 isAdminUser 守卫。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
преди 3 месеца
fengsilin
3e86f523db
feat(playground): temperature/top_p 参数互斥设置
部分上游模型不允许同时设置 temperature 和 top_p,新增管理员可配置的
模型前缀列表,匹配的模型在 Playground 中自动互斥切换两个参数。
- 后端新增 PlaygroundSetting 配置 + GET /api/playground/config 公开端点
- 运营设置页面新增 Playground 互斥模型前缀编辑 textarea
- Playground 自动检测模型名匹配,启用一个参数自动禁用另一个
- 默认包含 deepseek-v4-flash/pro、deepseek-reasoner、o1-/o3-/o4-、gpt-5
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
преди 3 месеца
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>
преди 3 месеца
fengsilin
b2cb7bcf60
feat: record chat and upstream ids in usage logs
преди 3 месеца
fengsilin
332d5a62f2
feat: support codex api key credentials
преди 3 месеца
fengsilin
1c0898257c
feat: add redemption remarks
преди 3 месеца
fengsilin
d8272e7707
feat(channel): 添加渠道"对外名称"(public_name)字段
为 Channel 模型新增 public_name 字段,让管理员可以为每个渠道
设置用户可见的友好名称(如"标准通道"、"高速通道"),替代前端
硬编码的"通道一/二/三"。Playground 通道选择器展示对外名称,
"渠道"统一改为"通道"。新建渠道时对外名称必填,编辑时可选。
Co-Authored-By: Claude <noreply@anthropic.com>
преди 3 месеца