fengsilin
8d22c4e80e
style(home): 临时隐藏首页工具链/核心价值/工作流/生态伙伴 section
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
355757404b
merge: feat/channel-pricing-extended → master
pirms 3 nedēļām
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>
pirms 3 nedēļām
fengsilin
f3577590bc
test(channel-pricing): 添加 API 端到端集成测试脚本
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
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>
pirms 3 nedēļām
fengsilin
c84c26b5a2
feat(channel-pricing): GetChannelPricingByModelWithChannelInfo 支持 CASE WHEN 回退 + 扩展字段
在 SQL 查询中使用 CASE WHEN > 0 回退策略,让渠道定价的扩展比率
(cache_ratio, cache_creation_ratio, image_ratio, audio_ratio,
audio_completion_ratio) 在未设置时自动回退到全局默认值,
而不是像 COALESCE 那样被零值拦截。同时更新 GROUP BY 子句包含所有
新选择的列,确保 MySQL 兼容。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
d5d4714908
test(channel-pricing): 缓存写穿 + 字段默认值单元测试
验证 ChannelPricing 的 Insert/Update/Delete 操作正确更新内存缓存,
以及未设置的扩展字段(CacheRatio 等)默认为零值。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
646f37dd4b
feat(channel-pricing): Controller 扩展 API 支持新字段 + 输入校验 + 操作日志
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
3a24fd598f
feat(channel-pricing): ModelPriceHelper + UpdatePriceDataForChannelPricing 适配新签名,支持扩展比率覆盖
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
e5f029f91e
feat(channel-pricing): InitDB 启动时全量加载渠道定价缓存
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
2d4c73d3aa
refactor(channel-pricing): 结构体新增扩展字段 + 缓存重写为全量加载写穿
- ChannelPricing 结构体新增 5 个扩展计费字段: cache_ratio, cache_creation_ratio, image_ratio, audio_ratio, audio_completion_ratio
- 缓存机制从 TTL+惰性加载重写为全量加载+写穿模式,消除 DB 查询延迟
- Insert/Update/Delete 改为写穿缓存(直接更新内存,不再整表失效)
- 新增 LoadChannelPricingCache 启动时全量加载函数
- 删除 RefreshChannelPricingCache/InvalidateChannelPricingCache(不再需要)
- BatchUpsertChannelPricing DoUpdates 列表同步新增 5 字段
- GetEffectivePricing 签名改为 (*ChannelPricing, bool)(调用方适配在后续 Task)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
156618fdad
merge: feat/alipay-payment → master
支付宝当面付扫码支付集成 + 代码重构
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
b514a0798b
refactor(payment): 合并微信/支付宝支付重复代码,删除冗余文件
- 提取通用 calcPayMoney/calcMinTopup 函数,消除微信和支付宝控制器中的重复计费逻辑
- 合并 RechargeAlipay/RechargeWechat 为 rechargeByQRCodePayment 内部函数,删除 model/topup_alipay.go
- 复用已有的 wrapAsPEM 替换支付宝专用的 wrapAlipayPublicKey
- 删除被 QRCodePayModal 替代的 WechatPayQRCodeModal.jsx
- 修复 controller/topup.go 中支付宝代码块的缩进错误
净减 264 行代码。
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 3 nedēļām
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>
pirms 3 nedēļām
fengsilin
befde35afa
feat(i18n): 全面国际化前端硬编码中文文本
将 14 个源码文件中的硬编码中文 UI 文本统一包裹到 t()/i18n.t() 调用,
覆盖登录注册、首页、设置页、工具函数等核心模块,并为 7 个语言文件
补充约 80+ 翻译键;修复 zh-CN.json 值误用繁体问题。
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
e08b5a447f
fix(router): 移除微信支付创建订单接口的 CriticalRateLimit 限流
避免用户扫码支付时因限流导致 429 错误。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 3 nedēļām
fengsilin
cf2a0a7992
fix(payment): 修复微信支付集成多项问题
- 修复订单号超 32 字符限制(微信支付要求),改用时间戳+随机字符格式
- 修复密钥解析:添加 wrapAsPEM 兼容 PEM/Base64/DER 多种输入格式
- 修复前端:RechargeCard 未识别 enableWechatTopUp 导致充值表单不显示
- 修复前端:支付按钮禁用逻辑未区分 epay/wechat_pay
- 移除状态轮询接口的 CriticalRateLimit 防止 429
- 过滤未启用易支付的旧支付方法避免混淆
- 修复 SiLinkedin 图标不存在导致构建失败
- 简化 webhook 冗余条件判断
- 添加密钥解析相关测试
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 3 nedēļām
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>
pirms 3 nedēļām
fengsilin
62f49a2bf7
merge: 上游 bug 修复 + Param Override 增强系统 + 批量余额查询
fix/cherry-pick-upstream-bugfixes 包含 3 个提交:
- fix: 移植上游关键 bug 修复(SSRF、Claude cache、定价过滤等 11 项)
- feat: 移植上游 Param Override 增强系统(9 种新 mode、Header Override、Audit 等)
- feat(region-sync): 批量查询用户余额接口,优化同步性能
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 4 nedēļām
fengsilin
b693a733ba
feat(region-sync): 批量查询用户余额接口,优化同步性能
RunQuotaSync 从逐个查询改为批量查询(每批500个),
减少 Master 节点 API 调用次数,提升同步效率。
新增:
- BatchQueryUserQuota 控制器接口
- BatchQueryQuota 客户端方法
- QuotaEntry/BatchQueryQuotaRequest/Response 类型
附带 update-image.sh 部署脚本。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 4 nedēļām
fengsilin
97485bfede
feat: 移植上游 Param Override 增强系统
从上游移植 override.go 的完整增强功能(603行→2057行),包括:
新增 9 种 Operation Mode:
- return_error: 规则直接返回 HTTP 错误中断请求
- prune_objects: 按 JSON Schema 过滤数组元素
- set_header / delete_header / copy_header / move_header: 动态管理上游请求头
- pass_headers: 透传下游请求头到上游
- sync_fields: 请求体不同路径间同步字段值
- 通配符路径支持: messages.*.role 等
新增核心模块:
- Header Override 系统:从上下文取值、正则匹配、列表追加
- Audit 审计系统:关键操作自动记录到 RelayInfo.ParamOverrideAudit
- Return Error 机制:含状态码/错误类型/跳过重试控制
- Legacy 兼容层:同时执行旧格式和新格式 param override
- RelayInfo 集成:丰富上下文(retry_index、last_error、request_headers 等)
RelayInfo 新增字段:RetryIndex, LastError, RequestHeaders,
RuntimeHeadersOverride, UseRuntimeHeadersOverride, ParamOverrideAudit
所有 handler 统一使用 ApplyParamOverrideWithRelayInfo,
全部测试通过(100+ test cases)。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 4 nedēļām
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>
pirms 4 nedēļām
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>
pirms 4 nedēļām
fengsilin
dc20782918
fix(region-sync): 修复 Settle/SyncManager 竞争条件并优化并发安全
- 新增 settled 状态,防止 SyncManager 在 PreConsume/Settle 之间同步未结算记录
- Settle 使用 AdjustSyncedQuota(增量 gorm.Expr)替代 UpdateSyncedQuota(绝对值),修复并发覆写
- 网络失败时标记所有记录为 failed 并增加 retry_count,避免无限重试
- 新增 ArchiveStalePendingRecords 定时清理崩溃请求的 pending 记录
- 简化 IsSyncedUser/IsLocalUser 移除冗余 id 参数
- Dockerfile 切换华为云 Go 镜像,移除不兼容的 GOEXPERIMENT=greenteagc
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 4 nedēļām
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>
pirms 4 nedēļām
fengsilin
b99337dab7
fix(pricing): 修复渠道定价优先级问题
当模型配置了渠道定价但全局定价未设置时,不再提前报错。
将全局定价检查延迟到渠道选择后执行。
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
2ea8501938
feat(pricing): 首页定价添加分页并优化渠道 ID 展示
- 首页定价区域添加响应式分页(移动端6/平板8/桌面9)
- 渠道列表显示 ID,支持在名称中查看
- 渠道定价卡片添加 ID 标签和使用提示 Banner
- 代码示例中展示 API Key 指定渠道的格式
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
4b17a67eea
content: 更新工具链描述文案
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
061423d21c
fix: 修复首页 Footer 无法完整下滑的问题
- 添加 home-snap-section 类让 Footer 参与 scroll snap
- 覆盖 min-height 和 height 为 auto,允许内容自适应
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
8041c22c5a
feat: 添加滚动导航组件
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
9fd8e099aa
style: 隐藏首页 CTA 区域和页脚版权信息
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
a7c7615a71
chore: 更新网站 Logo
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
f700adabb5
style: 重构首页组件样式与布局
- HeroSection: 调整标题字体大小与布局,修复缩进一致性
- ToolsSection: 改为 icon+title 同行布局,更新工具内容
- 移除 ChannelPricingCard 编辑图标和未使用导入
- 统一部分标题添加 font-bold 样式
- 临时注释部分展示元素(版权信息、核心价值标签等)
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
a95331a85f
chore: 隐藏侧边栏聊天子菜单、账户管理及隐私价格设置
- 注释侧边栏"聊天"子菜单,保留"操练场"
- 隐藏个人设置中的账户管理模块
- 隐藏其他设置中的价格设置和隐私设置Tab
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
bfa55d1b69
chore: 暂时隐藏模型详情页的调用示例组件
注释掉 ModelCodeSnippet 组件的导入和渲染。
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
106d3e4b4a
docs: 添加数据库表结构文档
详细记录 27 个数据库表的字段说明,包括用户、令牌、渠道、日志、订阅、定价等核心表结构。
Co-Authored-By: Claude <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
62737d3f8c
feat: 添加模型详情页渠道价格展示 & 优化筛选行布局
- 新增 API 端点获取模型在各渠道的定价信息,支持全局价格回退
- 在模型详情侧边栏添加渠道价格卡片,显示所有支持该模型的渠道
- 优化 HorizontalFilterRow 组件,改用 flex-wrap 自动换行布局
- 隐藏数量为 0 的模型类型筛选项
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
96e71a3be4
fix: 支持带供应商前缀的模型名称倍率匹配
当模型名称包含供应商前缀(如 "openai/o3-mini")时,自动尝试去掉前缀重新查找倍率配置。
- 在 GetModelPrice 和 GetModelRatio 函数中添加前缀剥离逻辑
- 在前端倍率配置页面添加提示说明
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
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>
pirms 1 mēnesi
fengsilin
3a32ab11dd
feat(model): 添加模型类型字段编辑功能
- 后端 Update 函数添加 type 字段支持更新
- 前端 EditModelModal 添加模型类型下拉选择器
- 新增 MODEL_TYPE_OPTIONS 共享常量(与后端 ModelType 一致)
- 添加中英文 i18n 翻译
- 修复首页"全部供应商"计数显示错误的 bug
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
3fb23b521a
fix: use Aliyun mirror for Debian packages in Docker build
Resolves 502 Bad Gateway errors when fetching from deb.debian.org
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
53f5522299
chore: add Docker build and push commands to Makefile
- Add docker-build target for building Docker images
- Add docker-push target for building and pushing images
- Dynamic tag format: {registry}:{timestamp}-{branch}
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
c58d01f628
refactor: improve code quality for token dynamic channel feature
1. Extract parseTokenKey helper function to eliminate code duplication
2. Add channelId validation to prevent invalid formats like sk-abc:def:ghi
3. Add database migration to drop deprecated bound_channel_id column
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
bfa7cc7b97
feat(token): support dynamic channel specification via colon separator
- Add support for sk-{key}:{channelId} format to specify channel dynamically
- Remove BoundChannelId field and related code
- All users can now specify channels, not just admins
- Add model validation when channel is specified
- Remove bound channel UI from token management
Breaking change: tokens can no longer be bound to channels at creation time.
Use sk-{key}:{channelId} format instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
5c57f692a5
feat: enhance channel pricing with price mode and color picker
- Add "by price" sub-mode for per-token pricing (auto-calculate ratios)
- Add color picker with preset colors in tag manager
- Display tags with colors in channel pricing view and selector
- Remove unused function, extract hardcoded color constants
- Fix pricing model filter (status==0 instead of status!=1)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
15a99da48e
fix: channel pricing not working correctly
This PR fixes three issues:
1. Token bound_channel_id not updating: Add bound field to Update() method
2. Channel pricing quota_type detection: Use QuotaTypeByCall constant instead of magic number 1
3. Log display for ratio-based pricing: Set ModelPrice=-1 for ratio-based pricing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
352806c099
feat: add dedicated API for user channel binding selection
Add a new /api/user/channels endpoint that returns only enabled channels
with non-sensitive fields (id, name, type, remark) for token channel binding.
Update EditTokenModal to use this endpoint and display remark instead of ID
in the channel dropdown.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
69713a92bd
fix: improve channel pricing UI and fix ratio naming
- Rename "输入倍率" to "模型倍率" for model_ratio field
- Rename "输出倍率" to "补全倍率" for completion_ratio field
- Update help text to reflect accurate pricing calculation
- Add search functionality for model filtering
- Improve table expansion behavior
- Fix channel data loading in ModelSettingsVisualEditor
- Conditionally show ratio/price fields based on quota type
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi
fengsilin
e5ec592c79
fix: use IconPriceTag instead of IconPrice/Tag
pirms 1 mēnesi
fengsilin
0653a8ddc2
feat: add channel binding field to token management and i18n keys
- Add bound_channel_id field to EditTokenModal for channel binding
- Load channels list for dropdown selection
- Add i18n translations for channel pricing features (zh-CN, en)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pirms 1 mēnesi