erio
2fe511366e
fix(billing): allow clearing group quota limits and treat 0 as zero-limit
...
Previously, v-model.number produced "" when input was cleared, causing
JSON decode errors on the backend. Also, normalizeLimit treated 0 as
"unlimited" which prevented setting a zero quota. Now "" is converted
to null (unlimited) in frontend, and 0 is preserved as a valid limit.
Closes Wei-Shaw/sub2api#1021
2026-03-15 15:47:10 +08:00
erio
7a5b9cffe5
chore: bump version to 0.1.99.2
2026-03-14 22:51:41 +08:00
erio
b4452d656b
fix(test): correct 401 escalation test for Gemini platform
...
The test case was named "antigravity_stays_temp" but used PlatformGemini,
which should escalate on 401 second hit per upstream logic.
2026-03-14 21:14:45 +08:00
erio
085c0d7e17
chore: bump version to 0.1.99.1
2026-03-14 21:03:20 +08:00
erio
25a0030450
Merge branch 'main' into release/custom-0.1.99
...
# Conflicts:
# backend/cmd/server/wire_gen.go
# backend/cmd/server/wire_gen_test.go
# backend/internal/handler/dto/mappers.go
# backend/internal/service/ratelimit_service.go
# backend/internal/service/ratelimit_service_401_db_fallback_test.go
# backend/internal/service/ratelimit_service_401_test.go
# frontend/src/components/account/AccountCapacityCell.vue
# frontend/src/components/account/CreateAccountModal.vue
# frontend/src/components/account/EditAccountModal.vue
# frontend/src/views/admin/DataManagementView.vue
2026-03-14 21:03:09 +08:00
erio
43449ebe16
fix(ops): tune aggregation constants to prevent PG overload
...
Increase MAX(bucket_start) query timeout from 3s to 5s and shrink
backfill window from 30 days to 1 hour.
2026-03-14 20:55:04 +08:00
Wesley Liddick
b9c31fa7c4
Merge pull request #999 from InCerryGit/fix/enc_coot
...
fix: handle invalid encrypted content error and retry logic.
2026-03-14 19:29:07 +08:00
Wesley Liddick
17b339972c
Merge pull request #1000 from touwaeriol/fix/ops-agg-tuning
...
fix(ops): tune aggregation constants to prevent PG overload
2026-03-14 19:03:03 +08:00
shaw
39f8bd91b9
fix: remove unused saveRecords method to pass lint
2026-03-14 19:01:27 +08:00
Wesley Liddick
aa4e37d085
Merge pull request #966 from GuangYiDing/feat/db-backup-restore
...
feat: 数据库定时备份与恢复(S3 兼容存储,支持 Cloudflare R2)
2026-03-14 18:58:56 +08:00
erio
f59b66b7d4
fix(ops): tune aggregation constants to prevent PG overload
...
Increase MAX(bucket_start) query timeout from 3s to 5s to reduce
timeout-induced fallbacks. Shrink backfill window from 30 days to
1 hour so that fallback recomputation stays lightweight instead of
scanning the entire retention range.
2026-03-14 18:47:37 +08:00
InCerry
8f0ea7a02d
Merge branch 'main' into fix/enc_coot
2026-03-14 18:46:33 +08:00
Wesley Liddick
a1dc00890e
Merge pull request #944 from miraserver/feat/backend-mode
...
feat: add Backend Mode toggle to disable user self-service
2026-03-14 17:53:54 +08:00
Wesley Liddick
dfbcc363d1
Merge pull request #969 from wucm667/feat/quota-fixed-reset-mode
...
feat: 账号配额支持固定时间重置模式
2026-03-14 17:52:56 +08:00
Rose Ding and Claude Opus 4.6
1047f973d5
fix: 按 review 意见重构数据库备份服务(安全性 + 架构 + 健壮性)
...
1. S3 凭证加密存储:使用 SecretEncryptor (AES-256-GCM) 加密 SecretAccessKey,
防止备份文件中泄露 S3 凭证,兼容旧的未加密数据
2. 修复 saveRecord 竞态条件:添加 recordsMu 互斥锁保护 records 的 load/save
3. 恢复操作增加服务端验证:handler 层要求重新输入管理员密码,通过 bcrypt
校验,前端弹出密码输入框
4. pg_dump/psql/S3 操作抽象为接口:定义 DBDumper 和 BackupObjectStore 接口,
实现放入 repository 层,遵循项目依赖注入架构规范
5. 改为流式处理避免大数据库 OOM:备份时 pg_dump stdout -> gzip -> io.Pipe ->
S3 upload;恢复时 S3 download -> gzip reader -> psql stdin,不再全量加载
6. loadRecords 区分"无数据"和"数据损坏"场景:JSON 解析失败返回明确错误
7. 添加 18 个核心逻辑单元测试:覆盖加密、并发、流式备份/恢复、错误处理等
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-14 17:48:21 +08:00
Wesley Liddick
e32977dd73
Merge pull request #997 from SsageParuders/refactor/bedrock-channel-merge
...
refactor: merge bedrock-apikey into unified bedrock channel with auth_mode
2026-03-14 17:48:01 +08:00
wucm667
b5f78ec1e8
feat: 实现固定时间重置模式的 SQL 表达式,并添加相关单元测试
2026-03-14 17:37:34 +08:00
SsageParuders
e0f290fdc8
style: fix gofmt formatting for account type constants
2026-03-14 17:32:53 +08:00
Wesley Liddick
fc00a4e3b2
Merge pull request #959 from touwaeriol/feat/antigravity-403-detection
...
feat(antigravity): add 403 forbidden status detection and display
2026-03-14 17:23:22 +08:00
Wesley Liddick
db1f6ded88
Merge pull request #961 from 0xObjc/codex/ops-openai-token-visibility
...
feat(ops): make OpenAI token stats optional
2026-03-14 17:23:01 +08:00
SsageParuders
4644af2ccc
refactor: merge bedrock-apikey into bedrock with auth_mode credential
...
Consolidate two separate channel types (bedrock + bedrock-apikey) into
a single "AWS Bedrock" channel. Authentication mode is now distinguished
by credentials.auth_mode ("sigv4" | "apikey") instead of separate types.
Backend:
- Remove AccountTypeBedrockAPIKey constant
- IsBedrock() simplified; IsBedrockAPIKey() checks auth_mode
- Add IsAPIKeyOrBedrock() helper to eliminate repeated type checks
- Extend pool mode, quota scheduling, and billing to bedrock
- Add RetryableOnSameAccount to handleBedrockUpstreamErrors
- Add "bedrock" scope to Beta Policy for independent control
Frontend:
- Merge two buttons into one "AWS Bedrock" with auth mode radio
- Badge displays "Anthropic | AWS"
- Pool mode and quota limit UI available for bedrock
- Quota display in account list (usage bars, capacity badges, reset)
- Remove all bedrock-apikey type references
2026-03-14 17:13:30 +08:00
erio
5c4cbaea71
style: fix gofmt formatting
2026-03-14 14:49:46 +08:00
erio
dfca591037
fix(test): add missing gatewayCache parameter to NewAccountHandler in test
2026-03-14 14:42:01 +08:00
erio
11cb34e56e
chore: bump version to 0.1.98.1
2026-03-14 14:10:40 +08:00
erio
22e9fa72af
Merge tag 'v0.1.98' into release/custom-0.1.97
...
修复 Codex/Responses 原生 input id 被误改写的问题,修复 OpenAI 模型映射和 chat-completions 兼容层多项问题。
- 修复 Codex/Responses 原生 input id 被误改写成 fc_* 前缀的问题
- 修复 OpenAI OAuth 账号的模型映射未在管理员可用模型列表中生效的问题
- 修复账号级模型映射未优先于分组回退的问题
- 修复账号更新时调度器快照未同步的问题
- 修复 chat-completions 兼容层中 reasoning_content 输出丢失的问题
- 修复 chat-completions 兼容层中 function_call id 无效的问题
- 修复 chat-completions 兼容层中默认映射模型在非调度回退场景下被错误应用的问题
- 修复 assistant 消息解析中 strings.Builder 写入错误未处理的问题
- 清理未使用的通配符映射辅助函数
2026-03-14 14:10:20 +08:00
erio
4e149109de
chore: bump version to 0.1.97.1
2026-03-14 14:07:42 +08:00
erio
5e0a508eca
Merge branch 'main' into release/custom-0.1.97
...
# Conflicts:
# README.md
# README_CN.md
# backend/internal/handler/gateway_handler.go
# backend/internal/repository/user_group_rate_repo.go
# backend/internal/service/admin_service_group_rate_test.go
# backend/internal/service/gateway_service.go
# frontend/src/components/account/CreateAccountModal.vue
# frontend/src/views/admin/AccountsView.vue
2026-03-14 14:07:05 +08:00
Wesley Liddick
2e3e8687e1
Merge pull request #993 from xvhuan/fix/codex-responses-id-prefix-hotfix-20260314
...
fix: 止血 Codex/Responses 原生 input id 被误改成 fc_*
2026-03-14 13:54:26 +08:00
ius
ca42a45802
fix: stop rewriting native responses input ids
2026-03-14 13:47:01 +08:00
Wesley Liddick
9350ecb62b
Merge pull request #987 from Ethan0x0000/feat-chatcompletions2repsonses-fix
...
fix: chat compatibility model fallback and reasoning_content output
2026-03-14 13:41:47 +08:00
Wesley Liddick
a4a026e8da
Merge pull request #990 from LvyuanW/admin-openai-available-models-fix
...
fix: respect OpenAI OAuth model mapping in admin available models
2026-03-14 13:33:18 +08:00
Wesley Liddick
342fd03e72
Merge pull request #986 from LvyuanW/openai-model-mapping-fix
...
fix: honor account model mapping before group fallback
2026-03-14 13:32:26 +08:00
Ethan0x0000
e3f1fd9b63
fix: handle strings.Builder write errors in assistant parsing
2026-03-14 13:12:17 +08:00
InCerry
e4a4dfd038
Merge remote-tracking branch 'origin/main' into fix/enc_coot
...
# Conflicts:
# backend/internal/service/openai_gateway_service.go
2026-03-14 13:04:24 +08:00
Wang Lvyuan
a377e99088
fix: remove unused wildcard mapping helper
2026-03-14 12:56:34 +08:00
Wang Lvyuan
1d3d7a3033
fix: respect OpenAI model mapping in admin available models
2026-03-14 12:45:10 +08:00
Wang Lvyuan
01ef7340aa
Merge remote-tracking branch 'origin/main' into openai-model-mapping-fix
2026-03-14 12:27:08 +08:00
Wang Lvyuan
1c960d22c1
fix: sync scheduler snapshot on account updates
2026-03-14 12:21:28 +08:00
Ethan0x0000
ece0606fed
fix: consolidate chat-completions compatibility fixes
...
- apply default mapped model only when scheduling fallback is actually used
- preserve reasoning in OpenAI-compatible output via reasoning_content and avoid invalid input function_call ids
2026-03-14 12:12:08 +08:00
InCerry
2666422b99
fix: handle invalid encrypted content error and retry logic.
2026-03-14 11:42:42 +08:00
Wesley Liddick
e6d59216d4
Merge pull request #975 from Ylarod/aws-bedrock
...
sub2api: add bedrock support
2026-03-14 10:52:24 +08:00
Wang Lvyuan
4e8615f276
fix: honor account model mapping before group fallback
2026-03-14 10:47:31 +08:00
erio
45456fa24c
fix: restore OAuth 401 temp-unschedulable for Gemini, update Antigravity tests
...
The 403 detection PR changed the 401 handler condition from
`account.Type == AccountTypeOAuth` to
`account.Type == AccountTypeOAuth && account.Platform == PlatformOpenAI`,
which accidentally excluded Gemini OAuth from the temp-unschedulable path.
Fix: use `!= PlatformAntigravity` instead, preserving Gemini behavior
while correctly excluding Antigravity (whose 401 is handled by
applyErrorPolicy's temp_unschedulable_rules).
Update tests to reflect Antigravity's new 401 semantics:
- HandleUpstreamError: Antigravity OAuth 401 now uses SetError
- CheckErrorPolicy: Antigravity 401 second hit stays TempUnscheduled
- DB fallback: split into Gemini (escalates) and Antigravity (stays temp)
2026-03-14 02:21:22 +08:00
Wesley Liddick
4588258d80
Merge pull request #960 from 0xObjc/codex/user-spending-ranking
...
feat(admin): add user spending ranking dashboard view
2026-03-13 23:06:30 +08:00
Wesley Liddick
c12e48f966
Merge pull request #949 from kunish/fix/remove-done-stop-sequence
...
fix: remove SSE termination marker from DefaultStopSequences
2026-03-13 22:56:29 +08:00
Wesley Liddick
ec8f50a658
Merge pull request #951 from wanXcode/fix/dashboard-user-trend-label
...
fix(dashboard): prefer username over email prefix in recent usage chart
2026-03-13 22:56:13 +08:00
Wesley Liddick
07bb2a5f3f
Merge pull request #952 from xvhuan/feat/billing-ledger-decouple-usage-log-20260312
...
feat: 解耦计费正确性与 usage_logs 批量写压
2026-03-13 22:46:09 +08:00
Wesley Liddick
417861a48e
Merge pull request #956 from share-wey/main
...
chore: codex transform fixes and feature compatibility
2026-03-13 22:36:29 +08:00
erio
05edb5514b
feat(redeem): support subscription type in create-and-redeem API
...
Add group_id and validity_days fields to CreateAndRedeemCodeRequest,
enabling subscription-type redemption codes to be created and redeemed
in a single API call.
- Type defaults to "balance" when omitted for backward compatibility
- Subscription type requires group_id (non-nil) and validity_days (>0)
- Existing balance/concurrency callers are unaffected
2026-03-13 21:26:46 +08:00
erio
7ab8181436
feat(redeem): support subscription type in create-and-redeem API
...
Add group_id and validity_days fields to CreateAndRedeemCodeRequest for
subscription redemption. Type defaults to "balance" for backward
compatibility with existing callers that don't send the type field.
2026-03-13 21:16:00 +08:00