Skip to content

Merge upstream/main (QuantumNous) + post-merge review fixes - #78

Merged
jjcc123312 merged 39 commits into
mainfrom
chore/merge-upstream-20260608
Jun 8, 2026
Merged

Merge upstream/main (QuantumNous) + post-merge review fixes#78
jjcc123312 merged 39 commits into
mainfrom
chore/merge-upstream-20260608

Conversation

@jjcc123312

Copy link
Copy Markdown

概述

同步上游 QuantumNous/new-api main36 个提交(自 2026-06-03 fork 分叉以来),并修复 post-merge review 发现的问题。

上游更新

冲突解决(8 文件,保留 fork 定制)

  • router/api-router.go:保留 Paddle webhook + POST epay/return,采纳上游 body limit 中间件
  • i18n(default zh.json / classic zh-TW.json):键取并集,采纳 渠道 措辞,保留 fork 键
  • 4 个 dialog(codex-usage / missing-models / prefill-group / billing-history):采纳上游 dialog 重构后重新植入 fork 定制(含 billing 的 Paddle「Reopen Checkout」功能)
  • pricing/index.tsx:保留 fork hero 重设计

Post-merge review 修复

/code-review max(9 角度 finder + 验证 + sweep)发现并修复:

严重度 问题 修复
distributor.go:上游 QuantumNous#5306 自动合并静默丢弃了 fork 的亲和渠道禁用 fail-fast(改为静默改路) 恢复 403 fail-fast,分层保留上游清缓存逻辑;复活孤儿 i18n key
中高 /paddle/webhook 缺 body 上限,未鉴权 io.ReadAll 存在内存耗尽 DoS anonymousRequestBodyLimit,与同类 webhook 一致
go test ./relay/helper/ RED(上游 QuantumNous#5225 test/源码不一致,两父提交均红) 经重试流分析确认生产码 reset 行为正确,修正测试断言(非改生产码)
prefill t() 缩进 / isPendingPaddleRecord 复用 isPaddlePayment / zh-TW 两处简体字形 修复

刻意保留(非缺陷):上游对验签类 webhook 的 body 上限(可配置的安全加固);i18n 复数式(fork 全站既有模式)。

验证

  • go build ./... / go vet ./middleware/
  • go test ./relay/helper/(由 RED → ok)、go test ./service/(affinity)
  • ✅ 前端 tsc -b
  • zh.json / zh-TW.json JSON valid

🤖 Generated with Claude Code

yyhhyyyyyy and others added 30 commits May 28, 2026 19:17
- expose a draft commit handle from the model pricing editor panel before saving.
- commit the open visual editor into the parent form before page-level save runs.
- support both desktop side editor and mobile sheet save paths.
- add consistent tab and field spacing so each pricing mode keeps the same visual rhythm.
- wrap per-request and tiered sections in shared field groups to match the per-token form structure.
- keep fixed-price descriptions and validation messages aligned with the updated field layout.
- add consistent tab and field spacing so each pricing mode keeps the same visual rhythm.
- wrap per-request and tiered sections in shared field groups to match the per-token form structure.
- keep fixed-price descriptions and validation messages aligned with the updated field layout.
Merge pull request QuantumNous#5296 from feitianbubu/pr/27fe9a3a82f51bac2b7645213e3b1480cb7f14f2
- Commit the open visual editor draft before saving model pricing settings
- Show unsaved draft differences against persisted model pricing values
- Move model pricing actions into the editor toolbar and refine the visual editor layout
- extract pricing form primitives, snapshot helpers, and table column setup to keep the editor components smaller.
- remove draft comparison UI now that switching models discards unsaved edits.
- refine the model list with a fixed actions column and tighter mode and price summary display.
- keep the global reset action in the top toolbar while moving visual-mode saves into the model editor footer.
- pin the actions header with the rest of the model table headers so horizontal scrolling keeps context visible.
- add action icons to make save and reset controls easier to scan.
* fix: evict stale channel affinity

* feat: configure disabled channel affinity retention

---------

Co-authored-by: Seefs <i@seefs.me>
* fix: limit anonymous request body (env ANONYMOUS_REQUEST_BODY_LIMIT_KB = 512)

* fix: allow disabling anonymous request body limit
- update the global thinking blacklist label to describe skipped suffix processing instead of disabled model thinking.
- rename Claude and Gemini adapter labels to thinking suffix adapter and sync all default locales.
- revise Claude helper text to clarify suffix request adaptation while keeping billing predictable.
* fix: 收窄 OpenAI o 系列模型适配范围

* fix(openai): 限制 gpt-5 适配仅作用于 OpenAI 模型

* fix(openai): narrow o-series reasoning model detection

---------

Co-authored-by: Seefs <i@seefs.me>
…g-cost-alignment

# Conflicts:
#	web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx
Merge pull request QuantumNous#5317 from P2K0/feat/profile-show-user-id
- render pricing JSON fields from shared configuration to reduce duplicated form markup.
- use fixed-height JSON textareas so long model maps scroll internally instead of stretching the page.
- arrange JSON editors in responsive columns to make wider settings pages easier to scan.
- introduce a shared themed JSON editor with line numbers, formatting, status feedback, and keyboard editing helpers.
- use the shared editor in model pricing JSON mode so pricing maps get consistent editor behavior.
- localize structured JSON validation messages so parse errors avoid browser-specific English text.
- place the model pricing tab switcher beside the page title instead of spanning the content area.
- keep the switcher width tied to its labels while preserving spacing around title status content.
- introduce a reusable dialog component for consistent header, body, and footer layout.
- support per-dialog sizing, trigger rendering, initial focus, and close button controls.
- preserve base dialog open and close motion classes while allowing content-specific styling.
- migrate frontend dialogs to the shared footer API so actions stay separated from scrollable body content.
- tune dialog dimensions for model analytics, prefill groups, billing history, channel model sync, and related workflows.
- update channel terminology and dialog action translations across supported locales.
t0ng7u and others added 9 commits June 6, 2026 23:14
Merge pull request QuantumNous#5275 from QuantumNous/fix/model-pricing-draft-save
Merge pull request QuantumNous#5339 from QuantumNous/perf/compact-display
Merge pull request QuantumNous#5328 from yyhhyyyyyy/fix/multiselect-popover-theme
Merge pull request QuantumNous#5161 from yyhhyyyyyy/fix/mobile-usage-log-cost-alignment
)

Merge pull request QuantumNous#5332 from yyhhyyyyyy/fix/model-pricing-six-decimal-step
Sync 36 upstream commits since 2026-06-03. Backend: relay GLM
chunked-encoding fix, anonymous request body limit, channel affinity
disable-cleanup config, relay idle timeout, OpenAI o-series scope
narrowing, stream-scanner buffer reuse, distributor video task_id
model resolution, dify file-pointer init. Frontend: shared dialog
wrapper + model-pricing visual editor refactor.

Conflicts resolved (8 files), preserving fork customizations:
- router/api-router.go: keep Paddle webhook + POST epay/return; adopt
  upstream anonymousRequestBodyLimit middleware on epay routes
- i18n (default zh.json, classic zh-TW.json): union of keys, adopt
  渠道 wording (matches fork convention), keep fork-added keys
- codex-usage-dialog / missing-models-dialog: take upstream dialog
  refactor, re-apply fork i18n/terminology tweaks
- prefill-group-management-dialog: take upstream refactor, re-apply
  fork i18n wrapping
- billing-history-dialog: take upstream refactor, re-apply fork's
  Paddle "Reopen Checkout" feature
- pricing/index.tsx: keep fork hero redesign over upstream copy
  simplification

Verified: go build ./... and web/default tsc -b both pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two regressions surfaced by post-merge review of the upstream sync:

- middleware/distributor.go: upstream QuantumNous#5306 auto-merge dropped the fork's
  fail-fast on a disabled affinity channel (it now silently re-routed to a
  random channel). Restore the 403 MsgDistributorAffinityChannelDisabled
  gate when ShouldSkipRetryAfterChannelAffinityFailure is set — consistent
  with controller/relay.go retry logic that still uses the same switch —
  while keeping upstream's ShouldKeepChannelAffinityOnChannelDisabled
  cache-clear path underneath. Also re-references the previously orphaned
  i18n key + translations.
- router/api-router.go: /paddle/webhook (fork-only route) was the only
  anonymous POST webhook lacking anonymousRequestBodyLimit, leaving an
  unauthenticated uncapped io.ReadAll (topup_paddle.go) open to a
  memory-exhaustion DoS. Apply the same 512KB cap as the sibling webhooks.

Verified: go build ./..., go vet ./middleware/, go test ./service/ (affinity).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-ups from the post-merge review (no production behavior change):

- relay/helper/stream_scanner_test.go: TestStreamScannerHandler_StreamStatus_
  PreInitialized asserted the pre-existing StreamStatus error was preserved,
  but StreamScannerHandler intentionally rebuilds StreamStatus per attempt so
  a transient error from a failed retry can't leak into the final success
  log (relayInfo is reused across the retry loop). Assertion was the defect;
  align it to the reset contract (error count -> 0) with an explanatory note.
  Fixes the pre-existing RED `go test ./relay/helper/`.
- billing-history-dialog.tsx: isPendingPaddleRecord now composes the existing
  isPaddlePayment() helper instead of re-referencing PAYMENT_TYPES.PADDLE
  inline (drops the now-unused import); behavior preserved.
- prefill-group-management-dialog.tsx: fix mis-indented multi-line t() block
  left by the merge conflict resolution.
- zh-TW.json: replace two Simplified-Chinese values with proper Traditional
  for the channel-affinity strings.

Verified: go test ./relay/helper/ (now ok), web/default tsc -b, zh-TW JSON parse.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jjcc123312
jjcc123312 merged commit 478b5af into main Jun 8, 2026
1 check 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.