b764d3b8f6
Merge remote-tracking branch 'origin/main' into feat/billing-ledger-decouple-usage-log-20260312
2026-03-12 16:53:28 +08:00
611fd884bd
feat: decouple billing correctness from usage log batching
2026-03-12 16:53:18 +08:00
30995b5397
Merge pull request #936 from xvhuan/fix/ops-write-pressure-20260311
...
降低 ops_error_logs 与 scheduler_outbox 的数据库写放大
2026-03-12 09:28:34 +08:00
eb60f67054
Merge pull request #933 from xvhuan/fix/dashboard-read-pressure-20260311
...
降低 admin/dashboard 读路径压力,避免 snapshot-v2 并发击穿
2026-03-12 09:28:14 +08:00
f0e08e7687
Merge pull request #930 from GuangYiDing/feat/gemini-25-flash-image-support
...
feat: 修复 Gemini 生图接口并新增前端生图测试能力
2026-03-12 09:27:19 +08:00
10b8259259
Merge pull request #909 from StarryKira/feature/admin-reset-subscription-quota
...
Feature/管理员可以重置账号额度
2026-03-12 09:26:47 +08:00
9d81467937
refactor: 重构 Chat Completions 端点,采用类型安全的 Responses API 转换
...
将 /v1/chat/completions 端点从 ResponseWriter 劫持模式重构为独立的
类型安全转换路径,与 Anthropic Messages 端点架构对齐:
- 在 apicompat 包新增 Chat Completions 完整类型定义和双向转换器
- 新增 ForwardAsChatCompletions service 方法,走 Responses API 上游
- Handler 改为独立的账号选择/failover 循环,不再劫持 Responses handler
- 提取 handleCompatErrorResponse 为 Chat Completions 和 Messages 共用
- 删除旧的 forwardChatCompletions 直传路径及相关死代码
2026-03-11 22:15:32 +08:00
8dd38f4775
Merge pull request #926 from 7976723/feat/chat-completions-compat-v2
...
feat: 添加 OpenAI Chat Completions 兼容端点(基于 #648,修复编译错误和运行时 panic)
2026-03-11 17:42:03 +08:00
f740d2c291
Reduce ops and scheduler write amplification
2026-03-11 17:32:00 +08:00
bf6585a40f
feat: add gemini image test preview
2026-03-11 17:12:57 +08:00
8c2dd7b3f0
Fix dashboard snapshot lint errors
2026-03-11 16:57:18 +08:00
4167c437a8
Reduce admin dashboard read amplification
2026-03-11 16:46:58 +08:00
6bbe7800be
Merge pull request #908 from wucm667/fix/ops-alert-group-account-metrics
...
fix: 补充缺失的组级和账户级运维告警指标
2026-03-11 15:04:07 +08:00
a17ac50118
fix: 修复 Chat Completions 编译错误和运行时 panic
...
1. 修复 WriteFilteredHeaders API 不兼容(2处):
将 s.cfg.Security.ResponseHeaders 改为 s.responseHeaderFilter,
因为 main 分支已将函数签名改为接受 *responseheaders.CompiledHeaderFilter
2. 修复 writer 生命周期导致的 nil pointer panic:
ChatCompletions handler 替换了 c.Writer 但未恢复,导致
OpsErrorLogger 中间件的 defer 释放 opsCaptureWriter 后,
Logger 中间件调用 c.Writer.Status() 触发空指针解引用。
通过保存并恢复 originalWriter 修复。
3. 为 chatCompletionsResponseWriter 添加防御性 Status() 和
Written() 方法,包含 nil 安全检查
4. 恢复 gateway.go 中被误删的 net/http import
2026-03-11 13:49:13 +08:00
656a77d585
feat: 添加 OpenAI Chat Completions 兼容端点
...
基于 @yulate 在 PR #648 (commit 0bb6a392) 的工作,解决了与最新
main 分支的合并冲突。
原始功能(@yulate):
- 添加 /v1/chat/completions 和 /chat/completions 兼容端点
- 将 Chat Completions 请求转换为 Responses API 格式并转换回来
- 添加 API Key 直连转发支持
- 包含单元测试
Co-authored-by: yulate <yulate@users.noreply.github.com >
2026-03-11 13:47:37 +08:00
e3cf0c0e10
fix: 补充缺失的组级和账户级运维告警指标
...
新增以下运维告警指标类型:
- group_available_accounts: 组内可用账户数
- group_available_ratio: 组内可用账户比例
- group_rate_limit_ratio: 组内限速账户比例
- account_rate_limited_count: 限速账户数
- account_error_count: 错误账户数
- account_error_ratio: 错误账户比例
- overload_account_count: 过载账户数
包含比例和计数类指标的评估逻辑,并注册新的百分比类指标用于阈值校验。
2026-03-10 11:29:31 +08:00
de18bce9aa
feat: add admin reset subscription quota endpoint and UI
...
- Add AdminResetQuota service method to reset daily/weekly usage windows
- Add POST /api/v1/admin/subscriptions/:id/reset-quota handler and route
- Add resetQuota API function in frontend subscriptions client
- Add reset quota button, confirmation dialog, and handlers in SubscriptionsView
- Add i18n keys for reset quota feature in zh and en locales
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-03-10 11:21:11 +08:00
00a0a12138
feat: Anthropic平台可配置 anthropic-beta 策略
2026-03-10 11:20:10 +08:00
ac6bde7a98
Merge pull request #872 from StarryKira/fix/oauth-linuxdo-invitation-required
...
fix: Linux.do OAuth 注册支持邀请码两步流程 (fix #836 )
2026-03-10 09:10:35 +08:00
d2d41d68dd
Merge pull request #894 from touwaeriol/pr/startup-concurrency-cleanup
...
feat: cleanup stale concurrency slots on startup
2026-03-10 09:08:33 +08:00
252d6c5301
feat: 支持批量重置状态和批量刷新令牌
...
- 提取 refreshSingleAccount 私有方法复用单账号刷新逻辑
- 新增 BatchClearError handler (POST /admin/accounts/batch-clear-error)
- 新增 BatchRefresh handler (POST /admin/accounts/batch-refresh)
- 前端 AccountBulkActionsBar 添加批量重置状态/刷新令牌按钮
- AccountsView 添加 handler 支持 partial success 反馈
- i18n 中英文补充批量操作相关翻译
2026-03-09 21:54:27 +08:00
7a4e65ad4b
feat: 导入账号时 best-effort 从 id_token 提取用户信息
...
提取 DecodeIDToken(跳过过期校验)供导入场景使用,
ParseIDToken 复用它并保留原有过期检查行为。
导入 OpenAI/Sora OAuth 账号时自动补充缺失的 email、
plan_type、chatgpt_account_id 等字段,不覆盖已有值。
2026-03-09 21:53:46 +08:00
a88698f3fc
feat: cleanup stale concurrency slots on startup
...
When the service restarts, concurrency slots from the old process
remain in Redis, causing phantom occupancy. On startup, scan all
concurrency sorted sets and remove members with non-current process
prefix, then clear orphaned wait queue counters.
Uses Go-side SCAN to discover keys (compatible with Redis client
prefix hooks in tests), then passes them to a Lua script for
atomic member-level cleanup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-09 19:55:18 +08:00
a461538d58
fix: 修复gpt->claude转换无法命中codex缓存问题
2026-03-09 15:08:37 +08:00
391e79f8ee
Merge pull request #875 from mt21625457/fix/openai-fast-billing-clean
...
fix(billing): 修复 OpenAI fast 档位计费并补齐展示
2026-03-09 10:32:18 +08:00
c7fcb7a84b
feat: apikey限额支持查询重置时间
2026-03-09 10:22:24 +08:00
87f4ed591e
fix(billing): 修复 OpenAI fast 档位计费并补齐展示
...
- 打通 service_tier 在 OpenAI HTTP、WS、passthrough 与 usage 记录中的传递
- 修正 priority/flex 计费逻辑,并将 fast 归一化为 priority
- 在用户端和管理端补齐服务档位与计费明细展示
- 补齐前后端测试,并修复 WS 限流信号重复持久化导致的全量回归失败
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-09 09:51:26 +08:00
97aaa24733
Merge pull request #858 from james-6-23/fix/pool-mode-03bf3485
...
支持 API Key 上游池模式的同账号重试次数配置与自定义错误策略
2026-03-09 08:48:53 +08:00
faf6441633
Merge pull request #854 from james-6-23/main
...
feat(admin): 支持定时测试自动恢复并统一账号恢复入口
2026-03-09 08:48:36 +08:00
106b20cdbf
fix claudecode review bug
2026-03-09 01:18:49 +08:00
c069b3b1e8
fix issue #836 linux.do注册无需邀请码
2026-03-09 00:35:34 +08:00
01180b316f
Merge pull request #841 from touwaeriol/feature/account-periodic-quota
...
feat(account): 为 API Key 账号新增日/周周期性配额限制
2026-03-08 20:34:15 +08:00
e643fc382c
feat: 支持 API Key 上游池模式同账号重试次数配置与自定义错误策略
2026-03-08 14:12:17 +08:00
0c29468f90
feat(admin): 支持定时测试自动恢复并统一账号恢复入口
...
- 为定时测试计划增加 auto_recover 配置,补齐前后端类型、接口、仓储与数据库迁移
- 在定时测试成功后自动恢复账号 error、rate-limit 等可恢复运行时状态
- 新增 /admin/accounts/:id/recover-state 接口,合并原有重置状态与清限流操作
- 更新账号管理菜单与定时测试面板,补充自动恢复开关、说明提示和状态展示
- 补充账号恢复、限流清理与仓储同步相关测试
2026-03-08 06:59:53 +08:00
03bf348530
fix(lint): gofmt formatting fixes for 3 files
...
Align struct field assignments and fix indentation detected by
golangci-lint v2.9's gofmt checker.
2026-03-07 23:24:09 +08:00
a3791104f9
feat: 支持后台设置是否启用整流开关
2026-03-07 21:55:38 +08:00
1ee17383f8
feat(account): add daily/weekly periodic quota limits for API Key accounts
...
Extend the existing total quota limit with daily and weekly periodic
dimensions. Each dimension is independently configurable and uses lazy
reset — when the period expires, usage is automatically reset to zero on
the next increment. Any dimension exceeding its limit will pause the
account from scheduling.
Backend:
- Add GetQuotaDailyLimit/Used, GetQuotaWeeklyLimit/Used, HasAnyQuotaLimit
- Rewrite IncrementQuotaUsed with atomic CTE SQL for 3-dimension update
- Rewrite ResetQuotaUsed to clear all dimensions and period timestamps
- Update postUsageBilling to use HasAnyQuotaLimit()
- Preserve daily/weekly used values on account edit
Frontend:
- Refactor QuotaLimitCard from single v-model to 3-dimension props
- Add QuotaBadge component for compact D/W/$ display
- Update AccountCapacityCell with per-dimension badges
- Update Create/Edit modals with daily/weekly quota fields
- Update AccountActionMenu hasQuotaLimit to check all dimensions
- Add i18n strings for daily/weekly/total quota labels
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-07 19:06:59 +08:00
92d35409de
feat: 为openai分组增加messages调度开关和默认映射模型
2026-03-07 17:02:19 +08:00
7079edc2d0
feat: announcement支持强制弹窗通知
2026-03-07 15:06:13 +08:00
a42a1f08e9
fix: 编辑error状态账号时保存报Status验证失败
...
后端UpdateAccountRequest.Status的oneof验证缺少error状态,
前端编辑表单也未处理error状态,导致编辑异常账号时无法保存
2026-03-07 13:47:08 +08:00
7a353028e7
fix: 修复keys速率限制未自动重置额度的bug
2026-03-07 10:13:51 +08:00
1b4d2a41c9
fix(openai): /v1/messages端点补齐Codex用量快照提取与错误透传规则
...
对齐/v1/responses的Forward方法,修复两处不一致:
- 成功响应时从响应头提取OAuth账号的Codex使用量数据
- 非failover错误场景下应用管理员配置的错误透传规则
2026-03-07 08:40:07 +08:00
f6709fb5d6
Merge pull request #824 from pkssssss/fix/ws-usage-window-pr
...
fix(openai): 修复 WS 模式下用量窗口不显示
2026-03-06 22:45:36 +08:00
921599948b
feat: /v1/messages端点适配codex账号池
2026-03-06 22:44:07 +08:00
dd25281305
chore(test): resolve merge conflict for ws usage window pr
2026-03-06 21:16:21 +08:00
838ada8864
fix(openai): restore ws usage window display
2026-03-06 20:49:47 +08:00
afbe8bf001
Merge pull request #809 from alfadb/feature/openai-messages
...
feat(openai): 添加 /v1/messages 端点和 API 兼容层
2026-03-06 20:16:06 +08:00
3403909354
fix(openai): support remote compact task
2026-03-06 18:51:05 +08:00
60fce4f1dc
fix: 修复 lite 模式跳过窗口费用查询导致 $0.00 显示的问题
...
commit 80ae592c 引入 lite 模式优化首次加载性能,但将窗口费用查询也一起跳过了。
commit 491a7444 尝试用 30 秒快照缓存修复,但缓存过期后问题复现。
移除窗口费用查询的 lite/非 lite 区分,始终执行 PostgreSQL 聚合查询。
同时删除不再需要的 account_window_cost_cache.go 文件。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-06 16:42:12 +08:00
bc194a7d8c
fix: address PR review - Anthropic error format in panic recovery and nil guard
...
- Add recoverAnthropicMessagesPanic for Messages handler to return
Anthropic-formatted errors instead of OpenAI Responses format on panic
- Add nil check for rateLimitService.HandleUpstreamError in
ForwardAsAnthropic to match defensive pattern used elsewhere
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-06 15:40:15 +08:00