Skip to content

release: v0.4.20 同步上游、更新无限画布并新增分组强制 Fast 计费 - #59

Merged
lien0219 merged 89 commits into
mainfrom
sync-upstream
Nov 14, 2026
Merged

lien0219 merged 89 commits into
mainfrom
sync-upstream

Conversation

@lien0219

Copy link
Copy Markdown
Owner
  • 同步 Sub2API 官方上游代码,保留 ModuRelay 定制功能。
  • 将无限画布更新至 v0.20.0,保留现有集成。
  • 新增分组“强制 Fast 计费”开关:开启后不依赖上游返回档位,按 Fast 计费;关闭时保持原有逻辑。
  • 修复 CI 环境及 Chromium 安装问题,升级 Go 至 1.27.4,修复标准库安全告警。
  • 将版本号升级至 v0.4.20。

验证:最新提交的 CI、Security Scan 共 7 项检查全部通过,已完成用户验收。

wucm667 and others added 30 commits October 16, 2026 20:32
/keys 页面要等密钥列表和每个 key 的用量统计都返回,才撤掉表格骨架屏。
用量统计(POST /usage/dashboard/api-keys-usage)按 api_key_id 汇总近 30 天的
usage_logs.actual_cost。数据量大时,要逐行回表读取几十万到上百万行,接口耗时
十几到三十几秒,甚至超时,页面就一直停在骨架屏。

- 前端:列表返回就渲染表格,用量列单独显示加载占位;统计失败时回落为 $0.0000。
- 后端:新增覆盖索引 (api_key_id, created_at) INCLUDE (actual_cost),使该统计可以
  index-only scan,不再回表。迁移采用 CONCURRENTLY 建索引;与其他 usage_logs
  索引迁移一样,重试前会先清理中断构建留下的 INVALID 索引。

Refs #5858

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
异步审计 worker 每 500ms 轮询一次数据库认领任务,本进程刚入队的任务
平均要等约 250ms 才被处理。入队成功和租约回收后改为立即通知本进程的
worker 尝试认领;worker 启动时先认领一次遗留任务。500ms 轮询保留不变,
继续兜底到期重试和其他副本入队的任务。
各 tab 表单很长,保存按钮只在滚到最底部时可见。改为 sticky 浮标贴在视口右下角,
样式沿用已有 tab 导航条的毛玻璃胶囊语言,深色模式覆盖放在非 scoped 块内。
Problem: SSE streams decide first-token time with the admin
openai_ttft_mode setting (semantic: first non-lifecycle event; visible:
first visible output), but WebSocket passthrough turns always wait for
the first ".delta" event and ignore the setting. On reasoning models the
reasoning item is announced when reasoning starts while the first delta
only arrives after it ends, so in semantic mode a WS turn reports the
reasoning time as first-token latency and an HTTP request does not. The
same user's WS turns look seconds slower than their HTTP requests, and
the gap grows with reasoning tokens while the HTTP numbers stay flat.

Fix: let RelayOptions take the first-token rule and have the passthrough
adapter pass the configured TTFT mode through the same check the SSE
path uses (openAIStreamDataStartsTTFT). codex.* frames are WebSocket-only
out-of-band events and never count; terminal events still never count,
as before. Without a rule the relay keeps the delta-based behaviour.

Test: TestOpenAIWSPassthroughFirstTokenFollowsTTFTMode replays two
reasoning turns on one passthrough connection in both modes and expects
each turn's first token at the event the SSE rule picks.
TestRelay_IsFirstTokenEventDecidesEveryTurnFirstToken checks the relay
applies the injected rule per turn and still skips terminal events.
部分上游在未请求 includeThoughts 时仍返回 thought=true 的 part,非流式转换把它当正文输出,导致 chat/messages 的 content 混入思考文字。转换时跳过思考 part 的文字,与流式路径的分流口径一致;用量仍取自 usageMetadata,计费不变。
Wei-Shaw and others added 29 commits November 10, 2026 21:28
…e-calls

fix(apicompat): preserve sealed function call metadata
…envelope

fix(apicompat): skip foreign CC Switch reasoning envelopes
…n-prefix

fix(openai): stabilize Responses session seeds across tool loops
…licy

fix(gateway): honor account error policies in compatibility paths
fix(gemini): 兼容入口非流式响应不再把思考摘要混入正文
…l-result-images

fix(antigravity): keep parallel tool functionResponses contiguous before media
fix(antigravity): isolate Pro Argon quota cooldowns
…code

fix(payment): configure EasyPay refund success codes per instance
…error

fix(scheduling): release acquired slot when account hydration fails
…rotation

fix(auth): consume refresh tokens atomically during rotation
…oning-mapping

fix(openai): apply mappings to synthesized reasoning effort
perf(keys): API 密钥列表不再等待 30 天用量统计,并为其加覆盖索引
fix(accounts): retain rows and quota values while refreshing
…er-6-decimals

fix(payment): support up to 6 decimals for balance recharge multiplier
feat(settings): 系统设置保存按钮改为底部吸附浮标
fix(openai): normalize Codex Desktop page context before tool validation
…tatus

fix(openai): preserve native Codex image error statuses
…-invalid-utf8

fix(openai): reject invalid UTF-8 Responses bodies
fix(securityaudit): 审计任务入队后立即唤醒本进程 worker
feat: add Claude Fable 5.2 and Mythos 5.2 support
Merge upstream 530c5e3 into sync-upstream.

Preserve ModuRelay branding, billing recovery, session binding, routing,
and TTFT fields while integrating atomic refresh tokens and cache TTLs.

Prior local verification passed backend unit/race and integration checks,
frontend tests, typecheck, lint, build, and the browser matrix.
Environment-dependent checks remain skipped; production is unverified.
- 开启后 OpenAI Token 请求统一按 priority 计费,忽略上游返回档位
- 默认关闭,关闭后保持原有计费逻辑
- 与免费 Fast 互斥,独立于强制 Fast 请求开关
- 完善配置持久化、认证缓存及计费回归测试
@lien0219
lien0219 merged commit e6088f2 into main Nov 14, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.