Commit Graph
2249 Commits
Author SHA1 Message Date
erio 1d4e1feb93 chore: bump version to 0.1.92.16 2026-03-07 14:34:08 +08:00
erioandClaude Opus 4.6 e890f177b9 refactor: usage queue groups by proxy exit identity instead of proxy_id
Anthropic OAuth/setup-token accounts are throttled by actual proxy
connection (host:port:username). Other platforms bypass the queue
entirely. Also adds unit tests for affinity and usage queue features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:33:52 +08:00
erioandClaude Opus 4.6 9b382a2dc7 feat: add affinity clients hover popover with last active times
- New API: GET /accounts/:id/affinity-clients returns client list with
  last_active timestamps from Redis ZSET scores
- New Lua script: get_affinity_clients_with_scores.lua uses ZREVRANGEBYSCORE
  WITHSCORES to return both client IDs and their timestamps
- New frontend component: AffinityBadge.vue replaces inline badge with
  hover popover that lazy-loads client details on first hover
- Shows client ID (monospace) + relative time (e.g. "3h ago")

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 13:50:39 +08:00
erio 5f5c41cef6 chore: bump version to 0.1.92.15 2026-03-07 12:53:29 +08:00
erioandClaude Opus 4.6 12f61daca4 fix: increase usage query throttle to 1-2s random delay
Widen the per-group delay between Anthropic usage API calls from
1-1.5s to 1-2s to avoid upstream 429 rate limiting when multiple
accounts share the same proxy exit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:53:28 +08:00
erioandClaude Opus 4.6 1864f41f33 merge: sync upstream/main into release/custom-0.1.92
Merge upstream main branch changes including:
- OpenAI Codex support and websearch adaptation
- API key rate limit auto-reset fix
- golangci-lint v2.11 upgrade for Go 1.26 compatibility
- Go 1.26.1 stdlib security fixes
- Empty stream failover fix
- CCSwitch import improvements
- API key credentials preserve existing fields
- Usage query rate limit optimization
- Setup Token real utilization fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:53:12 +08:00
erio fcdd34ddb0 chore: bump version to 0.1.92.14 2026-03-07 12:34:48 +08:00
erioandClaude Opus 4.6 7d276bc91d fix: ensure Lua scripts are loaded before pipeline EVALSHA calls
Pipeline mode only sends EVALSHA (no automatic fallback to EVAL).
If Redis restarts and script cache is lost, all pipeline Lua calls
silently fail with NOSCRIPT. Add ensureScriptLoaded() to pre-load
scripts before pipeline execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:34:36 +08:00
erio 87e0a0f299 debug: add temporary logging for affinity client batch query 2026-03-07 12:31:54 +08:00
erio 98abcb30e4 chore: bump version to 0.1.92.13 2026-03-07 12:12:11 +08:00
erioandClaude Opus 4.6 e73710144e fix: always return affinity_client_count for affinity-enabled accounts
Previously the count was only returned when Redis had data, causing
the badge to not display for accounts with zero affinity clients.
Now returns count=0 for all affinity-enabled accounts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:12:11 +08:00
shaw 6411645ffc fix: 适配claude code调度openai账号的websearch功能 2026-03-07 11:33:08 +08:00
shaw c0c322ba16 chore: openai账号模型映射新增claude->gpt快捷映射按钮 2026-03-07 10:26:30 +08:00
shaw d35c5cd491 feat: openai平台的apikey新增claude code使用教程 2026-03-07 10:14:57 +08:00
shaw 7a353028e7 fix: 修复keys速率限制未自动重置额度的bug 2026-03-07 10:13:51 +08:00
shaw 2d8d3b7857 fix(ci): upgrade golangci-lint v2.7 to v2.11 for Go 1.26 compatibility
golangci-lint v2.7 was built with Go 1.25 and cannot lint Go 1.26
targets. v2.8+ added Go 1.26 support.
2026-03-07 08:54:05 +08:00
Wesley Liddick 4190293b07 Merge pull request #823 from StarryKira/fix/empty-stream-failover
Fix/empty streamfix issue #791
2026-03-07 08:51:07 +08:00
Wesley Liddick 421b4c0aff Merge pull request #830 from ckken/pr/ccswitch-import-improvements
fix(ccswitch): improve import provider name and usage parsing
2026-03-07 08:49:09 +08:00
Wesley Liddick cd69a7cb85 Merge pull request #820 from geminiwen/fix/apikey-credentials-preserve-existing-fields
fix(account): preserve existing credentials when saving apikey accounts
2026-03-07 08:46:51 +08:00
shaw 0c9ba9e86c fix(security): upgrade Go 1.25.7 to 1.26.1 to resolve 4 stdlib vulnerabilities
GO-2026-4602 (os), GO-2026-4601 (net/url), GO-2026-4600 and
GO-2026-4599 (crypto/x509). The crypto/x509 fixes are only
available in go1.26.1+, not backported to go1.25.x.
2026-03-07 08:45:55 +08:00
shaw 1b4d2a41c9 fix(openai): /v1/messages端点补齐Codex用量快照提取与错误透传规则
对齐/v1/responses的Forward方法,修复两处不一致:
- 成功响应时从响应头提取OAuth账号的Codex使用量数据
- 非failover错误场景下应用管理员配置的错误透传规则
2026-03-07 08:40:07 +08:00
Wesley Liddick 0787d2b47a Merge pull request #829 from JIA-ss/fix/usage-query-rate-limit
fix(usage): 修复用量查询 429 重试风暴,增加负缓存、请求去重与随机延迟
2026-03-07 08:32:29 +08:00
erio ca5b3e6f7a chore: bump version to 0.1.92.12 2026-03-07 05:41:32 +08:00
erioandClaude Opus 4.6 fe832a4436 fix: upgrade golang.org/x/net to v0.51.0 (GO-2026-4559)
Fix govulncheck security vulnerability in net/http2 package.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 05:40:01 +08:00
erioandClaude Opus 4.6 2b6f3317d6 fix: resolve pre-existing CI failures (sora test mock, staticcheck)
- Add missing CountByStorageType method to stubSoraGenRepo test mock
- Suppress SA1019 for WithCredentialsJSON (admin-controlled source)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 05:31:01 +08:00
erioandClaude Opus 4.6 97343ed371 fix: resolve remaining gofmt alignment and deprecated API issues
- Fix struct tag alignment in dto/types.go (AffinityClientCount)
- Fix struct literal alignment in sora_generation_service.go
- Replace deprecated google.CredentialsFromJSONWithParams with
  option.WithCredentialsJSON for service account auth (SA1019)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 05:20:16 +08:00
erioandClaude Opus 4.6 4aada8a336 fix: resolve golangci-lint errors (gofmt, staticcheck, unused)
- Fix struct field alignment in dto/types.go, settings_view.go,
  sora_generation_service.go for gofmt compliance
- Remove embedded field "Account" from selector in account_handler.go (QF1008)
- Remove unused settingService field from SoraGDriveOAuthService
- Replace deprecated google.CredentialsFromJSON with CredentialsFromJSONWithParams (SA1019)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 05:13:33 +08:00
erioandClaude Opus 4.6 ea5e5dd9c7 feat: display client affinity count badge in account status column
Add colored circle badge showing affinity client count before the account
status indicator. Badge color reflects count severity (gray=0, green=1-5,
yellow=6-15, red=16+). Tooltip shows full client ID list on hover.

Backend: AccountHandler batch queries reverse affinity index via
GetAccountAffinityClientsBatch, returns affinity_client_count and
affinity_clients in DTO. GatewayCache interface extended with the new
batch method backed by a Lua script (get_affinity_clients.lua).

All test mocks synchronized with updated GatewayCache interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 04:52:10 +08:00
erioandClaude Opus 4.6 b9dc2e8eb5 refactor: remove dead RemoveClientAffinity code, add affinity scheduling tests
- Remove RemoveClientAffinity from GatewayCache interface, implementation,
  Lua script, and all test mocks (never called in production code)
- Add 26 unit tests for affinity scheduling: filterByMinAffinityCount,
  populateAffinityCounts, Layer 1/2 sort chain integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 04:26:08 +08:00
erioandClaude Opus 4.6 d707c1f93f feat: client affinity reverse index and balanced scheduling
- Separate clientAffinityTTL (24h) from stickySessionTTL (1h)
- Atomic Lua dual-write for forward (client→accounts) and reverse
  (account→clients) affinity indexes with lazy expiry cleanup
- Extract Lua scripts to standalone .lua files with //go:embed
- Add filterByMinAffinityCount to Layer 1 & 2 scheduling so new
  clients are routed to accounts with fewest existing affinities
- Skip Redis query when no affinity-enabled accounts exist (zero
  overhead for non-affinity users)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 04:10:54 +08:00
erio fbdba40f59 chore: bump version to 0.1.92.11 2026-03-07 03:16:02 +08:00
erioandClaude Opus 4.6 8d85cb57f1 feat: add client affinity toggle to create account modal
The client affinity setting was only available when editing an account.
Now it's also available during account creation for all Anthropic
platform types (OAuth, Setup Token, API Key).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 03:14:01 +08:00
ckken 97bf1d85ab feat(ccswitch): use site_name as default provider name in import link 2026-03-07 01:19:10 +08:00
ckken 207a493fab fix(ccswitch): parse remaining quota from /v1/usage response 2026-03-07 01:19:10 +08:00
JIA-ssandClaude Opus 4.6 1f3f9e131e fix: resolve golangci-lint errors (gofmt alignment, errcheck)
- Fix gofmt: align struct field comments in UsageCache, trim trailing
  whitespace on const comments
- Fix errcheck: use comma-ok on type assertion for singleflight result

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:58:08 +08:00
JIA-ssandClaude Opus 4.6 4ddedfaaf9 merge: resolve conflict with main (keep both openAI probe and usage fix)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:49:30 +08:00
JIA-ssandClaude Opus 4.6 3ebebef95f fix(usage): add negative caching, singleflight, and jitter to usage queries
Prevents 429 rate-limit retry storms and reduces upstream correlation risk
for Anthropic usage API queries.

Three changes:
1. Negative caching (1 min TTL) — 429/error responses are now cached,
   preventing every subsequent page load from re-triggering failed API calls.
2. singleflight dedup — concurrent requests for the same account are
   collapsed into a single upstream call, preventing cache stampede.
3. Random jitter (0–800 ms) — staggers multi-account cache-miss bursts so
   requests from different accounts don't hit upstream simultaneously with
   identical TLS fingerprints, reducing anti-abuse correlation risk.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:39:16 +08:00
erio 29d948bbfd Merge branch 'worktree-feature/sora' into release/custom-0.1.92 2026-03-07 00:35:35 +08:00
erioandClaude Opus 4.6 dac451ee0b feat(frontend): move provider selection into drawer and remove quota field
- Move storage provider selection (S3/GDrive) from separate modal into
  the drawer itself, shown as the first step when creating a new profile
- Provider type is locked once selected (read-only badge in header)
- Remove default_storage_quota_gb field from form and table column
- Remove unused formatStorageQuotaGB function and providerSelectOpen ref

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:34:11 +08:00
erioandClaude Opus 4.6 8071e9c4d8 fix(frontend): vertically center table row content in storage table
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:25:55 +08:00
erioandClaude Opus 4.6 a21f7d650b feat: display daily/weekly/total quota dimensions in account list
- Add quota_daily_limit/used and quota_weekly_limit/used to DTO and
  frontend Account type
- AccountCapacityCell shows D (daily), W (weekly), and $ (total) badges
  with color-coded status (green/yellow/red)
- AccountActionMenu shows reset button when any quota dimension is set
- Extract quotaBadgeClass/quotaBadgeTooltip as shared functions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:18:41 +08:00
erioandClaude Opus 4.6 e6b3808dcd fix(frontend): reduce action column height in storage table
Change flex-wrap gap-2 to items-center gap-1 to keep buttons on one line.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:15:06 +08:00
erio 5acf888d06 Merge remote-tracking branch 'origin/release/custom-0.1.92' into worktree-feature/sora 2026-03-06 23:58:40 +08:00
erioandClaude Opus 4.6 9e107fae73 feat(sora): improve storage management page with split columns, test buttons, quota and video stats
- Split compound "Profile" column into separate Profile ID and Name columns
- Replace "Endpoint" column with "Storage Path" showing bucket/prefix or folder info
- Add GDrive quota display (capacity/used) via new backend API endpoint
- Add video count statistics per storage type via new backend API endpoint
- Add inline test button per profile with 15s timeout and per-profile loading state
- Backend: GetQuotaInfo, CountByStorageType, GetGDriveQuota, GetStorageVideoStats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 23:58:27 +08:00
Gemini WenandClaude Opus 4.6 9f7ad47598 fix(account): clean up stale credentials fields after spreading currentCredentials
When customErrorCodes is disabled or modelMapping is empty, explicitly
delete the fields inherited from currentCredentials spread to avoid
preserving stale values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 23:38:58 +08:00
Gemini Wen 3c83cd8be2 Merge remote-tracking branch 'origin/main' into fix/apikey-credentials-preserve-existing-fields 2026-03-06 23:38:18 +08:00
erioandClaude Opus 4.6 6a7bcabb6f feat(frontend): add GDrive storage test button in profile drawer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 22:56:23 +08:00
Wesley Liddick 963b3b768c Merge pull request #825 from FizzlyCode/fix/setup-token-real-utilization
fix: Setup Token 账号使用真实 utilization 值替代状态估算
2026-03-06 22:46:20 +08:00
Wesley Liddick f6709fb5d6 Merge pull request #824 from pkssssss/fix/ws-usage-window-pr
fix(openai): 修复 WS 模式下用量窗口不显示
2026-03-06 22:45:36 +08:00
shaw 921599948b feat: /v1/messages端点适配codex账号池 2026-03-06 22:44:07 +08:00