3526 Commits

Author SHA1 Message Date
Brisbanehuang
26ca73a4cd fix: hide model scopes for non-antigravity plans 2026-05-17 02:20:41 +08:00
name
bec1e2b697 fix(openai): 永久禁用缺失 refresh_token 的 OAuth 账号
token_provider 在 expires_at 已过且 refresh_token 缺失时,仅返回 error,未做任何降级。
HandleUpstreamError 的 OAuth 401 分支也只走 10min 冷却,不区分账号是否具备刷新能力。
两条路径相加导致缺 refresh_token 的账号被反复选中、每次都在 token 阶段失败,对用户呈现持续 502。

token_provider.GetAccessToken: 命中"过期且无 refresh_token"时调用 SetError 永久禁用并清缓存,
依赖 background context 避免请求 ctx 提前结束影响落库。
ratelimit_service 401 OAuth 分支:refresh_token 为空时直接 SetError,不再写 expires_at、
不再 SetTempUnschedulable,缓存失效保留。RT 账号路径完全不动。

新增/调整测试覆盖两条路径,旧测试为 RT 路径补足 refresh_token 字段以保留原意图。
2026-05-16 19:40:23 +08:00
honue
360f8dec1a fix: 修复管理后台分组页可用账号数显示错误 2026-05-16 11:16:56 +08:00
name
0393bd7c82 Fix OpenAI compat usage parsing 2026-05-16 03:03:43 +08:00
yetone
b0c7723393
fix(admin/settings): make tab shell readable in dark mode
Vue's scoped-CSS compiler was dropping the `:global(.dark) .settings-tabs-shell`
rules in the production build, so the tab strip kept its light-mode white
background and the inactive tab labels (text-gray-300) showed at ~1.6:1
contrast — effectively unreadable.

Hoist the three dark-mode overrides into an unscoped `<style>` block so they
survive the scoped-CSS transform.
2026-05-16 01:00:03 +08:00
yangzc2004-bit
87fac30459 fix: use tier cooldown for google one gemini 429 2026-05-16 00:16:38 +08:00
Agoniedi
e46d2c2112 fix: avoid ops deep link initialization error 2026-05-15 23:59:51 +08:00
yetone
348a487739
fix(codex-transform): preserve underscore when rewriting call_* tool-call ids
`fixCallIDPrefix` builds malformed ids when the input has the standard
OpenAI `call_<nanoid>` prefix:

  input:  call_YYen1qxDejd2myJwcTCf7Nyp
  output: fcYYen1qxDejd2myJwcTCf7Nyp   ← no underscore between 'fc' and the nanoid

ChatGPT's codex backend then rejects the replayed item with:

  400 Invalid 'input[N].id': 'fcYYen1qxDejd2myJwcTCf7Nyp'.
       Expected an ID that contains letters, numbers, underscores, or
       dashes, but this value contained additional characters.

Sub2api wraps that into 502 to the client. Clients using the OpenAI SDK
on the OAuth/codex path see every multi-hop turn (after the first tool
call) fail because the item_reference rewritten this way gets sent on
every subsequent hop.

The other two branches of the same function correctly emit `fc_`
(line 1029: pass-through when already `fc*`; line 1035 fallback:
`fc_" + id`). Only the `call_` → `fc_` rewrite was missing the
underscore — looks like a copy-paste slip during the original commit.

Fix: change `"fc"` to `"fc_"` on the call_ branch. One character.

Repro:
  client (OpenAI SDK) sends a function_call_output whose call_id is
  `call_<nanoid>` (default OpenAI format). The sub2api request body
  also contains an item_reference whose id mirrors the call_id (also
  `call_<nanoid>`). On the codex OAuth path, this rewrite fires for
  the item_reference's id, producing the malformed value.

Affects: `platform=openai type=oauth` accounts whose clients use the
official OpenAI SDK / Responses API conventions (id prefix `call_`).
API-key accounts and bridge-mode requests are untouched.
2026-05-15 23:29:56 +08:00
shaw
6e66edbb09 chore: update sponsors 2026-05-15 20:58:47 +08:00
name
ff6f1640c4 fix(channels): 后端按次/图片计费跳过 token 区间重叠校验
前端在上一个 commit 已对 image / per_request 模式跳过 unbounded-last
和重叠检查, 但保存时后端仍按 token 语义校验, 导致添加第二个图片层级
时报错:

  invalid pricing intervals for platform 'openai' models
  [gpt-image-2 gpt-image-1.5 gpt-image-1]:
    interval #1: unbounded interval (max_tokens=null) must be the last one

ValidateIntervals 加 mode 参数, 与前端校验逻辑对齐:
- token 模式行为不变 (区间重叠 / last-unlimited 仍校验)
- per_request / image 模式跳过区间重叠和 last-unlimited 检查,
  保留单条 min/max 自洽校验与价格非负校验。

调用方 validatePricingIntervals 把 pricing.BillingMode 透给校验器。
既有单测全部加上 BillingModeToken 显式参数, 新增 3 个 image 模式用例
(允许多条 unbounded / 仍拒绝负价 / 仍拒绝 max <= min)。
2026-05-15 13:14:07 +08:00
wucm667
2ec1d331e0 fix(gateway): return Gemini models for Gemini groups 2026-05-15 11:33:26 +08:00
weak-fox
9f07741c13 fix: retry model capacity transient errors 2026-05-15 10:43:29 +08:00
weak-fox
ed7ef86347 test: add capacity retry regressions 2026-05-15 10:41:57 +08:00
name
c26d3ae1b5 feat(channels): 渠道未填价时按 LiteLLM 默认价展示
「可用渠道」展示链路有两个未覆盖场景导致用户看到"未配置定价":

1. admin 在 UI 里建了 ModelPricing 条目但没填任何价格 (常见于
   per_request / image 模式只填了 tier_label 没填单价): 原 fallback
   只检查 Pricing == nil, 这种空条目会跳过 LiteLLM 兜底。
2. LiteLLM 把图片模型标记 mode=image_generation, 但合成器固定按
   token 模式合成, 把 OutputCostPerImage / 图片 token 价丢到错误字段。

改动 (仅 backend/internal/service/channel_available.go):
- 新增 pricingNeedsFallback: 价格字段全空 (含 intervals 全空) 视为
  未配置, 触发 LiteLLM 兜底。
- synthesizePricingFromLiteLLM 加 existing 参数: 优先尊重渠道已选
  BillingMode (per_request / image 也按此模式合成), 没选才看 LiteLLM
  mode, 仍未命中默认 token。
- image / per_request 分支用 OutputCostPerImage 填 PerRequestPrice,
  OutputCostPerImageToken 填 ImageOutputPrice, 让 gpt-image / dall-e
  系列展示出参考价。

仅影响展示链路, 真实计费走 BillingService / ModelPricingResolver
完全不受影响。新增 8 个单元测试覆盖 pricingNeedsFallback 各分支、
合成器三种模式选择、空条目兜底与既有价格保护。
2026-05-15 01:28:13 +08:00
name
b936925c8a fix(channels): 按次/图片计费模式跳过 token 区间重叠校验
image 与 per_request 模式的层级按 tier_label (1K/2K/4K) 匹配,
不依赖 min/max token 范围, 多个层级共用 min=0/max=null 是预期形态。
原校验器一律按 token 上下文分段处理, 新增第二条图片层级时会被
"无上限区间只能是最后一个" 误拦, 导致 OpenAI gpt-image 等模型
无法保存按次定价。

validateIntervals 新增 mode 参数, image / per_request 模式跳过
区间重叠与 last-unlimited 检查, 保留单条 min/max 自洽与价格非负
校验。token 模式行为不变。
2026-05-14 23:48:47 +08:00
wucm667
a611742910 fix(gateway): detach upstream context unconditionally for image generation
Image generation requests (forwardOpenAIImagesOAuth and
forwardOpenAIImagesAPIKey) were calling detachStreamUpstreamContext with
parsed.Stream, which for non-streaming requests (Stream=false) simply
returned the original client context unchanged. When the client
disconnected before the upstream completed (30-80s for image gen), the
context cancellation propagated to the upstream HTTP request, causing a
502 error despite the upstream having already started processing.

Switch to detachUpstreamContext (unconditional detach) so the upstream
image generation request is always bound to a background context and
completes regardless of client lifecycle.

Fixes #2310
2026-05-14 18:03:18 +08:00
wucm667
e9637148dd fix(openai): pass service_tier by default 2026-05-14 16:45:31 +08:00
cepvor
ab6510f1a0 fix(repo): 为公告查询添加分页上限,优化分组按账户数排序的数据加载
- announcement ListActive: 添加 Limit(200) 防止无界查询
- group listWithAccountCountSort: 改为先只查 ID + sort_order,
  再批量加载账户统计,排序分页后仅加载当前页的完整实体,
  避免全量加载所有字段后做内存排序。

Co-Authored-By: deepseek-v4-pro[1m] <deepseek-ai@claude-code-best.win>
2026-05-14 16:38:45 +08:00
wucm667
f9d5ccdf24 test(gateway): check Gemini chat completion assertions 2026-05-14 15:33:10 +08:00
wucm667
827764d7bd fix(account): preserve combined model restrictions 2026-05-14 15:00:28 +08:00
wucm667
041d138f76 fix(gateway): route Gemini chat completions upstream 2026-05-14 11:48:00 +08:00
wucm667
862819042c feat(openai): 支持后台配置 Responses API 路由 2026-05-14 11:46:24 +08:00
wucm667
61b6272110 fix(payment): apply product affix to subscriptions 2026-05-14 11:36:02 +08:00
wucm667
a5acefcc9e fix(install): 检查 Bash 版本并提示升级 2026-05-14 11:35:07 +08:00
wucm667
4d51e53d20 fix(redeem): 修复批量复制兑换码兼容性 2026-05-14 11:35:00 +08:00
astr0-g
be15a3e6ce fix passthought 首token时间计算修复 2026-05-13 18:01:09 -07:00
wucm667
679c0865a0 fix(openai): handle versioned compatible base URLs 2026-05-13 11:25:15 +08:00
gaoren002
32a79be962 fix(openai): add codex auto review model pricing 2026-05-12 09:26:53 +00:00
2ue
115535e1d5 Update unit tests for image size resolver 2026-05-12 16:12:08 +08:00
2ue
4840194b18 Fix lint issues in image billing change 2026-05-12 16:04:24 +08:00
2ue
bb4c1abe28 Fix image billing size normalization 2026-05-12 15:21:31 +08:00
shaw
18790386a7 fix(deploy): 移除数据库与 Redis 宿主机端口映射 2026-05-12 15:16:39 +08:00
imlewc
224e9fc6c2 fix(auth): prefer OIDC compat email in pending flow 2026-05-12 14:35:20 +08:00
hoobnn
4467922199 fix: add autocomplete="one-time-code" for TOTP autofill support
Add a hidden input with autocomplete="one-time-code" so password managers
(1Password, Bitwarden, Chrome, Apple Keychain) can detect and auto-fill
TOTP verification codes during 2FA login.
2026-05-12 13:54:41 +08:00
github-actions[bot]
62ccd0ff39 chore: sync VERSION to 0.1.126 [skip ci] 2026-05-11 15:30:51 +00:00
Wesley Liddick
3d7e7b78cf
Merge pull request #2356 from jack-atlas/fix/openai-messages-multi-tool-continuation
Preserve multi-tool context in OpenAI messages continuation
2026-05-11 23:03:24 +08:00
shaw
ea751f6515 test: update admin settings contract for Antigravity UA 2026-05-11 22:55:02 +08:00
Wesley Liddick
ca17c364e5
Merge pull request #2319 from wucm667/codex/fix-openai-unpriced-usage-log
fix(openai): record zero-cost usage for unpriced models
2026-05-11 22:45:17 +08:00
Wesley Liddick
ac91de8592
Merge pull request #2353 from XiaoYu994/fix/openai-429-plan-type-sync
fix: sync OpenAI plan type from usage limit errors
2026-05-11 22:28:13 +08:00
shaw
a07a0dac63 feat: add configurable Antigravity user agent version 2026-05-11 22:25:20 +08:00
shaw
9377c96746 fix: 让消息 cache_control 改写默认关闭 2026-05-11 21:26:41 +08:00
shaw
297b54d066 fix: 完善工具名改写测试和格式 2026-05-11 17:27:04 +08:00
Wesley Liddick
1088e27cd1
Merge pull request #2340 from iFwu/fix/mimic-rewrite-tool-use-in-messages
fix(mimic): rewrite tool_use names in messages to match renamed tools
2026-05-11 16:53:00 +08:00
XiaoYu994
c3a1471775 fix: sync OpenAI plan type from usage limit errors 2026-05-11 16:22:40 +08:00
Wesley Liddick
1e2f55078c
Merge pull request #2289 from wucm667/fix/ccswitch-import-model
fix(ccswitch): 修复 Codex 导入缺少模型参数
2026-05-11 16:12:47 +08:00
Wesley Liddick
348eeaa06a
Merge pull request #2297 from ZeroDeng01/dev
fix(gemini): 修复 Gemini Vertex Service Account 账号测试时,前置 OAuth token 请求没有使用账号代理的问题
2026-05-11 16:12:20 +08:00
Wesley Liddick
f19421b16e
Merge pull request #2247 from anzhen-tech/codex/fix-ws-replay-function-call-output
fix: preserve replay tool output continuation
2026-05-11 16:11:37 +08:00
shaw
18cc4691e6 优化系统设置页标签导航 2026-05-11 16:10:40 +08:00
Jack
87d73236f2 Preserve multi-tool context in OpenAI messages continuation
Claude Code can send one assistant turn with multiple tool_use blocks followed by a user turn containing matching tool_result blocks. The OpenAI /v1/messages compatibility path trimmed continuation input to the last user turn plus adjacent tool outputs, which could leave a function_call_output without its earlier function_call when previous_response_id was attached.

This keeps all function_call items needed by retained function_call_output entries so the upstream Responses API can resolve every call_id.

Constraint: Applies only to the OpenAI /v1/messages -> Responses compatibility continuation path.

Rejected: Disable previous_response_id for all tool outputs | loses continuation and cache benefits for valid turns.

Confidence: high

Scope-risk: narrow

Directive: Do not trim function_call_output entries without preserving their matching function_call call_id context.

Tested: go test ./internal/service -run 'TestForwardAsAnthropic_(PreviousResponseIDKeepsMultiToolCallContext|AttachesPreviousResponseIDForCompatContinuation|OAuthPreservesClaudeCodeToolCallID)' -count=1

Tested: go test ./internal/service -run 'TestForwardAsAnthropic|TestApplyAnthropicCompatFullReplayGuard|TestOpenAICompat|Test.*ToolContinuation' -count=1

Tested: go test ./internal/pkg/apicompat -count=1

Related: #2337
2026-05-11 12:03:17 +08:00
ZeroDeng
37ec21e1a5
Merge branch 'main' into dev 2026-05-11 11:48:55 +08:00