fengsilin
1c15ee996d
feat(ratio): 升级未设置倍率模型编辑弹窗,对齐可视化编辑器
- 将操作列「高级比例」按钮改为编辑图标按钮,打开完整编辑弹窗
- 编辑弹窗新增定价模式切换(按量计费/按次计费)
- 按量计费下支持按倍率设置和按价格设置两种子模式
- 按倍率:模型倍率、补全倍率
- 按价格:输入价格、输出价格($/1M tokens),自动计算倍率
- 高级比例区域:缓存读取、缓存创建、图片、音频输入、音频输出
- 修复 SubmitData 遗漏高级倍率字段保存的 bug(CacheRatio 等 5 个字段)
- 清理死代码(未调用的转换函数、残留 console.log)
1 settimana fa
fengsilin
182ab5ff83
refactor(ratio): move advanced ratios to edit modal in unset models page
- Remove advanced ratio columns from the table
- Add 'advanced ratios' button in action column
- Add edit modal with Form.InputNumber fields (same as visual editor)
- Table stays clean, advanced settings only visible on click
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
1fdf0a3f47
feat(ratio): add advanced ratio fields to unset models editor
- Add cache/image/audio ratio columns to the table
- Add advanced ratio fields to the add model modal
- Update data init, submit, and addModel to handle new fields
- Use formRef to read InputNumber values (same fix as visual editor)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
d36a686f6b
fix(ratio): preserve 0 as valid value for advanced ratio fields
- Replace || with ?? in addOrUpdateModel to keep 0 values (0 || '' = '')
- Add null check in SubmitData to avoid writing undefined
- Fix formRef value reading to preserve 0 vs empty distinction
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
c824381642
fix(ratio): read advanced ratio values from form on submit
Form.InputNumber values were not synced to currentModel state via
onChange, so the advanced ratio fields were always empty when saving.
Now reads values directly from formRef in onOk handler.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
a8c739e466
feat(ui): add extraText descriptions and fix placeholder for advanced ratios
- Add extraText for cache read ratio and cache creation ratio fields
- Update placeholder format to match channel pricing convention
- Add missing i18n translations for extraText and new placeholders
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
192eb70862
feat(save): serialize and save advanced ratio fields
- Add 5 new fields to output object
- Convert model data to float and populate output fields
- Serialize all fields to JSON in finalOutput
- Submit 7 total option fields (2 existing + 5 new)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
91e648c530
feat(add): handle advanced ratios in addOrUpdateModel
- Add 5 advanced ratio fields to updatedModel object
- Use empty string fallback for undefined values
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
194ebbaa56
feat(edit): populate advanced ratios in edit modal
- Add 5 advanced ratio fields to formRef.current.setValues
- Ensure existing ratio data displays correctly in edit modal
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
2ca560ccef
feat(ui): add advanced ratios form section
- Add Form.Section with 5 advanced ratio input fields
- Configure min={0}, step={0.01} for all fields
- Add placeholders showing default values
- Only show when pricingMode === 'per-token'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
fengsilin
0ea023037a
feat(ratio): parse advanced ratio fields in data initialization
- Parse 5 new JSON fields from props.options
- Extend modelNames Set to include keys from all ratio fields
- Add 5 new fields to model data objects
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 settimana fa
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 settimana fa
fengsilin
8150993caf
fix(admin): improve channel form inputs
Expose channel public_name in the edit modal and load a larger channel page when building model settings views.
Co-Authored-By: Codex <noreply@anthropic.com>
1 settimana fa
fengsilin
3cf84775f2
feat: add channel metrics collector, fix search pagination and vendor sort order
- Register Prometheus ChannelCollector in GetMetrics() sync.Once block
- Add MetricsMiddleware to /v1 and /v1beta relay router groups when metrics enabled
- Remove public_name field from channel creation form and validation
- Restore InvitationCard in topup page
- Extract fetchSearchPage helper in useModelsData to eliminate ~50 lines of duplication; fix setSearching with finally block; use Axios params for URL encoding; fix missing vendor_counts update during paginated search
- Fix vendor ordering in HomePricingFilters to follow vendorsMap sort_order; fix O(n²) Array.includes to use Set
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 settimane fa
fengsilin
6434a523a1
feat: passthrough model mapping
2 settimane fa
fengsilin
d32050d081
fix: restore login widget bundle and guard custom nav link
2 settimane fa
fengsilin
54573991a4
feat: add customLink configuration UI in header nav settings
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3 settimane fa
fengsilin
84eb6d6a88
feat: 端点格式限制功能 + 完善测试
当开启端点格式限制后,不同协议的渠道只能通过对应的端点访问:
- Anthropic 渠道只能用 /v1/messages
- Gemini 渠道只能用 /v1beta/models/*
- OpenAI 系渠道只能用 /v1/chat/completions 等
- VertexAI/阿里云等支持多协议的渠道不受限
核心实现:EndpointFormatGuard 中间件从请求路径推导协议家族,
不依赖 gin context 中的 relay_format(因 group middleware 执行
时 context 中尚无此值)。
修复了 /v1/models/*path 和 /v1/engines/ 路径被错误归类为
openai 家族的 bug(实际是 Gemini 格式)。
单元测试 58 个,E2E 测试 15 个,覆盖:
- 路径分类边界(含 Gemini relay 路径修复验证)
- 渠道类型覆盖(含非 LLM 渠道透传)
- 并发安全、运行时开关切换
- 错误消息 JSON 结构和内容验证
3 settimane fa
fengsilin
ea0d4e5cde
refactor: 完整删除前端渠道选择和默认通道 UI
4 settimane fa
fengsilin
69ed7d85d7
feat(sidebar): 添加监控外部链接菜单项
在管理员菜单区域新增「监控」入口,仅 root 用户可见,
点击后在新窗口打开外部监控面板。支持在侧边栏模块管理中切换显示/隐藏。
同时在 renderWrapper 中添加外部链接的通用支持。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
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>
1 mese fa
fengsilin
d26ad9e635
feat: 渠道-模型级联选择 + 隐藏首页统计卡片
- UserRatioSection 模型输入改为级联下拉,选渠道后自动加载模型列表
- models 信息嵌入 channelOptions 消除冗余 channelMap 状态
- 注释掉首页 HeroSection 统计数据卡片
Co-Authored-By: Claude <noreply@anthropic.com>
1 mese fa
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 mese fa
fengsilin
8bb2883d7e
feat(home): 首页定价卡片添加"去体验"按钮,跳转 Playground
- PricingCardView 新增 showTryButton 属性,点击跳转 Playground 并预选模型
- 移除 PricingCardView 中未使用的 props (selectedGroup, currency 等)
- 首页页脚路由重命名: terms→user-agreement, usage-policy→privacy-policy
- i18n: "操练场"更名为"对话"
Co-Authored-By: Claude <noreply@anthropic.com>
1 mese fa
fengsilin
74cc8c0d56
feat(playground): 添加渠道选择功能,支持指定渠道体验模型
- 新增 /api/user/model_channels 接口,返回模型可用渠道及默认渠道
- Playground 设置面板添加渠道选择下拉框
- Distribute 中间件支持从请求体读取 channel_id 指定渠道
- 支持 URL 参数 ?model=xxx 直接选择模型
Co-Authored-By: Claude <noreply@anthropic.com>
1 mese fa
fengsilin
967309fb56
feat: 添加邮箱后缀注册额度规则功能
管理员可在用户管理页面配置「邮箱后缀→初始额度」映射规则,
用户注册时根据邮箱后缀自动匹配并发放对应额度(替代默认额度)。
- 新增 email_quota_rule 数据表 + CRUD API(管理员权限)
- 内存缓存匹配,启动时加载,增删改时刷新
- 注册流程 Insert/InsertWithTx/FinalizeOAuthUserCreation 同步支持
- 前端用户管理页新增 Tab 展示规则管理卡片
- 含 24 个测试(model 16 + controller 8)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
fengsilin
20163dbad5
fix(legal): 法律文档页面切换语言时强制重新加载内容
给 DocumentRenderer 添加 key={lang} 属性,确保切换语言时组件
重新挂载并从 API 获取对应语言的内容,而非使用缓存内容。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
fengsilin
934b4b10a7
feat: 法律文档双语配置(中/英)+ 精简语言支持至中英双语
- LegalSettings 字段拆分为 _zh/_en 双语对
- API 支持 ?lang= 参数返回对应语言内容
- 后台设置页每个文档配语言切换按钮(中文/English)
- 前端页面根据 UI 语言自动请求对应内容
- 移除 fr/ru/ja/vi/zh-TW 语言支持
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
fengsilin
1cc75aa9a2
feat: 服务条款和使用政策页面,支持后台 Markdown 配置
复用现有 LegalSettings 模式,新增 TermsOfService 和 UsagePolicy 字段,
添加 /terms 和 /usage-policy 前端页面及 API 端点。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
fengsilin
518f1ab87f
refactor(frontend): 移除拖拽排序,改为 sort_order 数值输入
回退 @dnd-kit 拖拽实现,改为在编辑弹窗中直接设置 sort_order 数值:
- 模型编辑弹窗新增「排序」InputNumber 字段
- 供应商编辑弹窗新增「排序」InputNumber 字段
- 模型表格新增 sort_order 显示列
- 移除 @dnd-kit 依赖及所有 DnD 相关代码
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
fengsilin
65880fc69b
feat(frontend): Vendor Tab 和 Model 表格支持拖拽排序,移除定价页字母排序
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
fengsilin
e507897f21
feat(pricing): updatePricing 按 sort_order 排序 vendors 和 models
- vendorsList 按 vendor.SortOrder 升序排列,相同则按 ID 排序
- pricingMap 按 model.SortOrder 升序排列,相同则按模型名字典序
- 修复默认通道设置的 API 错误响应未正确展示的问题
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
fengsilin
3a29f3772f
feat(channel): 添加模型默认通道功能,支持优先路由和卡片标识
- 新增 is_default 字段和缓存层,支持管理员为模型指定默认通道
- Distribute 中间件优先级调整:Token 指定 → 默认通道 → 亲和性 → 随机
- 模型定价卡片和详情弹窗展示默认通道 amber 标识
- 管理后台定价页面新增星标切换默认通道
- 新增 set_default / clear_default API 和 6 个单元测试
- 简化卡片价格显示(移除内联缓存价格,改为详情弹窗展示)
Co-Authored-By: Claude <noreply@anthropic.com>
1 mese fa
fengsilin
93e331b624
feat: 支持 LOGO_FILE_PATH 环境变量指定本地 Logo,优化定价与语言设置
- 新增 LOGO_FILE_PATH 环境变量,优先级高于数据库配置,支持本地文件服务
- 渠道定价高级字段(缓存/图片/音频)不再回退全局默认值,未设置直接返回 0
- 缓存价格单位从表头移到具体价格值,新增渠道 ID 复制功能
- 修复默认语言在用户已有偏好时仍被覆盖的问题
- img 标签统一添加 referrerPolicy/crossOrigin 防止跨域问题
- 新增缓存倍率和最小余额阈值的详细说明文本
Co-Authored-By: Claude <noreply@anthropic.com>
1 mese fa
fengsilin
94f24b29f7
style: 首页文案"全球"改为"顶级"
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 mese fa
fengsilin
387f6c1ae0
feat(pricing): 定价数据源切换到渠道表,新增缓存价格展示
- 后端 pricing API 从 channel_pricings 表获取实际定价,选取最便宜渠道
- 提取 applyGlobalDefault 辅助函数消除全局回退逻辑重复
- price.go 重构扩展比率为局部变量,简化回退逻辑
- 定价卡片新增缓存读取/创建价格,改为两行布局防止溢出
- ChannelPricingCard 缓存列显示实际价格而非倍率
- 修复移动端 hero 区域 padding 过大
- 默认标签页标题改为 Loading...
- 新增缓存读取/创建 i18n 翻译(7 语言)
Co-Authored-By: Claude <noreply@anthropic.com>
1 mese fa
fengsilin
8d22c4e80e
style(home): 临时隐藏首页工具链/核心价值/工作流/生态伙伴 section
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 mese fa
fengsilin
235f7c6e5f
refactor(channel-pricing): 提取 ParseTagIds 辅助函数 + 移除调试 console.log
- 将 tag ID 解析逻辑提取为 model.ParseTagIds,消除 model 层和 controller 层重复代码
- 统一 TrimSpace 处理(之前 controller 版本漏了)
- 移除 ChannelPricingView 残留的 console.log('Expanded keys:')
- 删除多余空行
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 mese fa
fengsilin
129e17ac42
feat(channel-pricing): 前端支持缓存/图片/音频倍率编辑和展示
- ChannelPricingView.jsx: initValues 添加 5 个高级比例字段 + 按量计费模式下新增高级比例表单区块
- ChannelPricingCard.jsx: tableData 映射 cache_ratio/cache_creation_ratio + 条件列展示
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 mese fa
fengsilin
e8ade3abae
feat(payment): 集成支付宝当面付扫码支付 + 补全前端 i18n 硬编码中文
支付宝支付:
- 后端:新增 topup_alipay.go、payment_alipay.go,实现当面付(扫码支付)下单、
回调验签、订单状态查询完整流程,支持 RSA2 签名
- 前端:新增 QRCodePayModal 通用二维码支付弹窗(泛化微信支付弹窗)、
SettingsPaymentGatewayAlipay 管理配置页面、充值流程接入支付宝
- 充值历史:管理员视图新增用户邮箱列,后端 fillTopUpEmails 批量填充
i18n 补全:
- 54 个缺失翻译 key 添加到全部 7 个 locale 文件(zh-CN/zh-TW/en/fr/ja/ru/vi)
- 涵盖渠道名称、仪表盘标签、兑换码状态、控制台时间筛选、Playground 错误消息、
Dashboard 设置页面提示等
- 14 个源码文件中约 31 处 showError/showSuccess/showWarning 硬编码中文改用 t()
- ChannelsColumnDefs、helpers、services 中散落的硬编码中文统一国际化
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 mese fa
fengsilin
befde35afa
feat(i18n): 全面国际化前端硬编码中文文本
将 14 个源码文件中的硬编码中文 UI 文本统一包裹到 t()/i18n.t() 调用,
覆盖登录注册、首页、设置页、工具函数等核心模块,并为 7 个语言文件
补充约 80+ 翻译键;修复 zh-CN.json 值误用繁体问题。
Co-Authored-By: Claude <noreply@anthropic.com>
2 mesi fa
fengsilin
00e266cd77
feat(payment): 集成微信支付 Native(扫码支付)V3 API
完整实现微信支付充值和订阅购买功能,支持配置热更新、二维码扫码支付、
回调验签、订单状态轮询,以及管理后台支付网关设置。
后端:
- 新增微信支付 V3 客户端(支持 Base64/文件路径两种密钥加载)
- Native 下单、回调处理、订单状态查询 API
- 充值订单幂等完成(事务+行锁)
- 订阅购买支持微信支付
- 配置变更自动重置客户端
- 提取 createWechatNativeOrder 消除重复下单逻辑
前端:
- 二维码扫码弹窗(含倒计时、自动轮询状态)
- 微信支付设置页面(AppID、商户号、密钥等 12 项配置)
- 充值页集成微信支付流程
依赖:go-pay/gopay v1.5.117
Co-Authored-By: Claude <noreply@anthropic.com>
2 mesi fa
fengsilin
296edf0f71
fix: 移植上游关键 bug 修复
从 QuantumNous/new-api 上游移植以下修复:
- fix(ssrf): 加固视频代理和 MJ 图片代理的 SSRF 防护,FetchModels 提权至 RootAuth
- fix(claude): 流式断流时不再整份覆盖 usage,保留 cache 计费字段
- fix(pricing): 定价接口增加用户可用分组过滤
- fix(ratio): compact 模型优先匹配精确定价再回退通配符
- fix(ali): 接受 task polling 返回的字符串类型 usage 值
- fix(gemini): 从 URL 路径 :streamGenerateContent 检测流式请求
- fix(zhipu_4v): coding plan 图片生成使用正确的 OpenAI endpoint
- fix(openai): MessageImageUrl.Detail 字段添加 omitempty
- fix(channel-affinity): skip_retry_on_failure 配置项为 false 时不再丢失
- fix(document-renderer): 使用 useMemo 替代 useState 处理 HTML payload
- fix(fetch-setting): ApplyIPFilterForDomain 默认值改为 true
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 mesi fa
fengsilin
9d4a595465
feat(region-sync): Master→Slave 配置同步、热更新与前端修复
- 新增 GET /api/internal/sync/config 接口,Master 下发 MinBalanceThreshold、MaxRetryCount、SyncBatchSize、SyncIntervalSeconds
- Slave 每 5 分钟从 Master 拉取配置并持久化到本地数据库,确保重启不丢失
- 统一 startWorker 支持动态间隔,同步间隔前端修改后无需重启立即生效
- 主节点地址从 TagInput 改为 Form.Input,修复 JSON 数组格式问题
- stringToArray 兼容 JSON 数组和换行分隔两种格式
- 清理根目录测试脚本(已迁移到 test-scripts/)
Co-Authored-By: Claude <noreply@anthropic.com>
2 mesi fa
fengsilin
1cecd5349d
feat: 跨区域配额同步(Master-Slave Region Sync)
实现 Master-Slave 架构的跨区域用户和配额同步功能,支持国内主节点与
海外从节点之间的用户创建推送、余额同步、预扣费批量回传。
主要变更:
- 新增 region_sync 服务层(SyncManager/SyncClient/推送逻辑)
- User 模型扩展 Source/RemoteUserId/SyncedQuota/LastSyncAt 字段
- BillingSession 支持 SyncedUserFunding 资金来源
- 新增 SyncAuth 中间件(X-Sync-API-Key + 常量时间比较)
- 新增 PendingSyncRecord/QuotaSyncLog 数据模型
- 前端新增区域同步配置面板
- 支持 SESSION_NAME 环境变量避免多节点 cookie 冲突
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 mesi fa
fengsilin
2ea8501938
feat(pricing): 首页定价添加分页并优化渠道 ID 展示
- 首页定价区域添加响应式分页(移动端6/平板8/桌面9)
- 渠道列表显示 ID,支持在名称中查看
- 渠道定价卡片添加 ID 标签和使用提示 Banner
- 代码示例中展示 API Key 指定渠道的格式
Co-Authored-By: Claude <noreply@anthropic.com>
2 mesi fa
fengsilin
4b17a67eea
content: 更新工具链描述文案
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 mesi fa
fengsilin
061423d21c
fix: 修复首页 Footer 无法完整下滑的问题
- 添加 home-snap-section 类让 Footer 参与 scroll snap
- 覆盖 min-height 和 height 为 auto,允许内容自适应
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 mesi fa
fengsilin
8041c22c5a
feat: 添加滚动导航组件
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 mesi fa
fengsilin
9fd8e099aa
style: 隐藏首页 CTA 区域和页脚版权信息
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 mesi fa