Skip to content

Sync upstream/main#12

Open
github-actions[bot] wants to merge 16 commits into
mainfrom
sync/upstream-main
Open

Sync upstream/main#12
github-actions[bot] wants to merge 16 commits into
mainfrom
sync/upstream-main

Conversation

@github-actions
Copy link
Copy Markdown

Codex审查:本次 upstream 主要是 web/default 的主题/日志/设置页 UI 调整,以及后端订阅余额购买、日志筛选和渠道测试修复;主要风险为前端构建与余额扣费/usage 查询行为,建议维护者跟进验证。

合并建议:谨慎合并。web/default 与后端核心均被触及,未见高危破坏性变更,但订阅余额支付和 usage/log 筛选需要手动确认。

更新文件:

  • 后端核心:controller/subscription.gomodel/subscription.gorouter/api-router.go 新增余额购买订阅接口与扣费逻辑。
  • 后端核心:model/log.go 调整 model/username 日志筛选,默认精确匹配,显式 % 才走 LIKE。
  • 后端核心:controller/channel-test.go 渠道测试改用请求用户或 root 用户,不再固定 user_id=1。
  • web/default:主题相关 theme-customization.tstheme-presets.cssstatus-badge.tsx 增加 simple-large/xl 并改变 badge 默认视觉,可能间接影响“洛音云枢”全局观感。
  • web/default:usage logs 新增移动端卡片 usage-logs-mobile-card.tsx,并调整日志表格列样式和筛选 schema。
  • web/default:系统设置、支付设置、渠道操作 API 错误处理有大量 UI/交互调整。
  • web/classic:未触及;Docker、GitHub Actions、依赖锁、构建流程:未触及。

下一步:维护者最应先跑 web/default 类型检查/构建,并手动验证“洛音云枢”首页/登录页/后台在亮暗色和不同主题密度下的视觉。随后验证余额购买订阅、usage/log 精确/通配筛选、渠道测试是否符合预期。

Workflow note: 后续上游同步会更新这个 PR;详细审查和同步信息默认折叠,避免 PR 顶部过长。

这个同步流程如何工作
  • 从官方 upstream/main 拉取新提交。
  • main 的同步分支上尝试合并 upstream。
  • 自动生成影响分析和 Codex 审查。
  • 创建或更新当前同步 PR。
  • 如果出现冲突,会停止创建 PR 并记录冲突文件。
Codex审查报告

风险等级

MEDIUM,原因是 web/default 改动面积大且包含全局主题/badge/usage logs 移动端新组件,同时后端新增余额购买订阅并调整日志筛选;未触及 web/classic、Docker、workflow、依赖锁,风险未升到 HIGH。

我查看了什么

  • git show --stat --oneline --decorate --no-renames HEAD
  • git diff --name-status a64f26d..74985fa
  • git diff a64f26d..74985fa -- model/log.go controller/subscription.go model/subscription.go model/topup.go router/api-router.go
  • git diff a64f26d..74985fa -- controller/channel-test.go controller/channel_test_internal_test.go
  • git diff a64f26d..74985fa -- web/default/src/lib/api.ts web/default/src/lib/theme-customization.ts web/default/src/styles/theme-presets.css web/default/src/components/status-badge.tsx
  • git diff a64f26d..74985fa -- web/default/src/features/usage-logs/components/usage-logs-table.tsx web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx
  • git diff a64f26d..74985fa -- web/default/src/features/subscriptions/api.ts web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx web/default/src/features/wallet/index.tsx
  • rg -n "洛音云枢|洛音|云枢" . -g '!dist' -g '!build' -g '!vendor' -g '!node_modules'
  • git diff --name-only a64f26d..74985fa -- 'Dockerfile*' '.github/**' 'go.mod' 'go.sum' 'web/default/package.json' 'web/default/bun.lock*' 'web/classic/**'
  • git diff --check a64f26d..74985fa

影响范围

“洛音云枢”自定义文件 web/default/src/custom/luoyin/* 未改动,但全局主题 preset、density scale、StatusBadge、日志表格样式会间接影响后台视觉;web/default 被大量触及,web/classic 未触及。后端 API 影响订阅余额支付、日志筛选和渠道测试;usage 统计会受日志筛选精确/通配语义影响;流式主链路未见直接 relay 改动,仅渠道测试仍会记录 stream 测试日志;Docker/构建/依赖/workflow 未触及。

重点文件

  • model/subscription.go / controller/subscription.go:新增余额购买订阅,事务中扣用户 quota、创建订阅和订单;需确认 SQLite/MySQL/PostgreSQL 下扣费事务、购买上限、分组升级和 quota cache 一致。
  • model/log.goapplyExplicitLogTextFilter 让无 % 的 model/username 查询变成精确匹配,有 % 才走 LIKE ESCAPE '!';这是预期修复,但会改变管理员 usage 查询习惯。
  • web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx:新增移动端日志卡片;其中通用泛型组件直接访问 row.original.created_at/type,未构建验证,存在 TypeScript 类型检查风险(不确定)。
  • web/default/src/styles/theme-presets.css / theme-customization.ts / status-badge.tsx:新增 simple-large 和 xl scale,同时 StatusBadge 默认显示 dot、移除背景面,会影响多个表格和主题视觉。
  • web/default/src/lib/api.ts / features/channels/api.ts:扩展 Axios config 并让渠道操作跳过全局错误 toast,改由调用处显示错误,需验证不会漏报 401 以外错误。
  • controller/channel-test.go:渠道测试用当前用户或 root 用户获取 cache/group 并记录消费日志,修复 user_id=1 假设,但自动测试依赖存在 root 用户。

手动检查

  • web/default 能通过 TypeScript/生产构建,特别检查 usage-logs-mobile-card.tsx 泛型访问。
  • “洛音云枢”首页、登录页、公共 header、后台 sidebar 在 light/dark、default/simple-large、sm/default/lg/xl 下没有明显错位。
  • Usage logs 桌面和移动端展示 common/task/drawing 三类日志,筛选、分页、复制和敏感信息显示正常。
  • 管理员和用户日志筛选分别验证:model 精确值、gpt%、非法/过短 % 模式、username 精确/通配,以及统计总量一致。
  • 余额购买订阅验证余额充足、不足、免费套餐、达到购买上限、升级分组、重复点击/并发点击。
  • 渠道测试以非 1 号管理员执行,确认日志归属、用户分组和计费上下文正确。

验证步骤

  1. 在维护者环境执行 cd web/default && bun run build,先排除前端类型/构建错误。
  2. 启动应用后用“洛音云枢”主题路径访问首页、登录页、后台 usage logs 和钱包订阅页,做一次余额购买成功与余额不足场景。
  3. 用管理员账号在 usage logs 分别输入精确模型名和带 % 的模型名,确认列表与统计口径符合预期;再执行一次单渠道测试和全部渠道测试。

Codex审查:gpt-5.5

同步信息

Metadata

Target branch: main
Fork sha: 118830b02582b97f8ca3d3da6eeafb785ad81d5e
Upstream sha: 74985fa877b4a85decdf31044b2435cf688af395
Merge base: a64f26d1d23e56472c11fd77c32ea743ca8f24bd
Workflow run: https://github.com/CharyeahOwO/new-api/actions/runs/26481695722

Automatic impact analysis

  • Risk: MEDIUM
  • Label: risk-medium
  • Reason: Frontend, build, dependency, or workflow files changed.

Module signals

  • web/default: yes
  • web/classic: no
  • backend core: yes
  • build/deploy: no
  • dependencies: no
  • GitHub Actions: no
  • docs only: no

File count

  • Changed files: 61

Upstream commits

74985fa8 fix: keep token log filters exact
1d320373 fix: keep usage log filters exact unless wildcard is explicit (#5097)
dc245ae7 fix(web): improve channel and usage log UI
f8add4ca feat(theme): add simple-large preset, xl scale and clean up channel badge dots
65f8afe9 🐛 fix(system-settings): resolve save detection and number input NaN issues
5bc4c748 🎨 fix(logs): tune usage table typography
30025aeb fix: use actual user id for channel tests (#5109)
c91ba0c4 fix: consolidate Waffo payment settings save flow (#5110)
f223db93 🎨 fix(charts): improve dark mode chart readability
9e283ab1 🎨 fix(logs): remove hardcoded font-mono to support global theme font inheritance
a8b7c92e 🎨 fix(logs): restore timing background badges and optimize model/token spacing
6b6c9904 feat(subscription): support balance purchases
10119349 🎨 fix(theme): default theme font preset falls back to Sans instead of Serif
bc8110ce 🎨 refactor(badge): restore status-badge sizes and classic color scheme
ad224ecf fix: prevent duplicate channel action toasts (#5015)

Changed files

M	controller/channel-test.go
M	controller/channel_test_internal_test.go
M	controller/subscription.go
M	model/log.go
M	model/subscription.go
M	model/topup.go
M	router/api-router.go
M	web/default/src/components/config-drawer.tsx
M	web/default/src/components/group-badge.tsx
M	web/default/src/components/status-badge.tsx
M	web/default/src/components/ui/select.tsx
M	web/default/src/components/ui/sidebar.tsx
M	web/default/src/features/channels/api.ts
M	web/default/src/features/channels/components/channels-columns.tsx
M	web/default/src/features/channels/components/dialogs/multi-key-manage-dialog.tsx
M	web/default/src/features/channels/components/dialogs/ollama-models-dialog.tsx
M	web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx
M	web/default/src/features/channels/constants.ts
M	web/default/src/features/channels/hooks/use-channel-upstream-updates.ts
M	web/default/src/features/channels/lib/channel-actions.ts
M	web/default/src/features/dashboard/components/overview/overview-dashboard.tsx
M	web/default/src/features/pricing/components/model-details-charts.tsx
M	web/default/src/features/rankings/components/market-share-section.tsx
M	web/default/src/features/rankings/components/models-section.tsx
M	web/default/src/features/subscriptions/api.ts
M	web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx
M	web/default/src/features/system-settings/auth/oauth-section.tsx
M	web/default/src/features/system-settings/auth/passkey-section.tsx
M	web/default/src/features/system-settings/auth/section-registry.tsx
M	web/default/src/features/system-settings/content/dashboard-section.tsx
M	web/default/src/features/system-settings/general/pricing-section.tsx
M	web/default/src/features/system-settings/general/system-behavior-section.tsx
M	web/default/src/features/system-settings/integrations/creem-product-dialog.tsx
M	web/default/src/features/system-settings/integrations/monitoring-settings-section.tsx
M	web/default/src/features/system-settings/integrations/payment-settings-section.tsx
M	web/default/src/features/system-settings/integrations/waffo-pancake-settings-section.tsx
M	web/default/src/features/system-settings/integrations/waffo-settings-section.tsx
M	web/default/src/features/system-settings/maintenance/performance-section.tsx
M	web/default/src/features/system-settings/models/grok-settings-card.tsx
A	web/default/src/features/system-settings/utils/numeric-field.ts
M	web/default/src/features/usage-logs/components/columns/column-helpers.tsx
M	web/default/src/features/usage-logs/components/columns/common-logs-columns.tsx
M	web/default/src/features/usage-logs/components/columns/drawing-logs-columns.tsx
M	web/default/src/features/usage-logs/components/columns/task-logs-columns.tsx
M	web/default/src/features/usage-logs/components/model-badge.tsx
A	web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx
M	web/default/src/features/usage-logs/components/usage-logs-table.tsx
M	web/default/src/features/wallet/components/subscription-plans-card.tsx
M	web/default/src/features/wallet/index.tsx
M	web/default/src/i18n/locales/en.json
M	web/default/src/i18n/locales/fr.json
M	web/default/src/i18n/locales/ja.json
M	web/default/src/i18n/locales/ru.json
M	web/default/src/i18n/locales/vi.json
M	web/default/src/i18n/locales/zh.json
M	web/default/src/i18n/static-keys.ts
M	web/default/src/lib/api.ts
M	web/default/src/lib/currency.ts
M	web/default/src/lib/theme-customization.ts
M	web/default/src/routes/_authenticated/usage-logs/$section.tsx
M	web/default/src/styles/theme-presets.css

Diff stat

 controller/channel-test.go                         |  40 +-
 controller/channel_test_internal_test.go           |  11 +
 controller/subscription.go                         |  23 +
 model/log.go                                       |  51 +-
 model/subscription.go                              | 101 ++++
 model/topup.go                                     |   2 +
 router/api-router.go                               |   1 +
 web/default/src/components/config-drawer.tsx       |   3 +-
 web/default/src/components/group-badge.tsx         |   2 +-
 web/default/src/components/status-badge.tsx        |  48 +-
 web/default/src/components/ui/select.tsx           |  55 +-
 web/default/src/components/ui/sidebar.tsx          |  23 +-
 web/default/src/features/channels/api.ts           | 128 ++--
 .../channels/components/channels-columns.tsx       |  79 +--
 .../components/dialogs/multi-key-manage-dialog.tsx |   2 +
 .../components/dialogs/ollama-models-dialog.tsx    |  22 +-
 .../components/drawers/channel-mutate-drawer.tsx   |  18 +-
 web/default/src/features/channels/constants.ts     |   4 +-
 .../channels/hooks/use-channel-upstream-updates.ts |  15 +-
 .../src/features/channels/lib/channel-actions.ts   |  36 +-
 .../components/overview/overview-dashboard.tsx     |  85 +--
 .../pricing/components/model-details-charts.tsx    |  51 +-
 .../rankings/components/market-share-section.tsx   |  29 +-
 .../rankings/components/models-section.tsx         |  29 +-
 web/default/src/features/subscriptions/api.ts      |   7 +
 .../dialogs/subscription-purchase-dialog.tsx       |  71 ++-
 .../system-settings/auth/oauth-section.tsx         | 465 +++++++++------
 .../system-settings/auth/passkey-section.tsx       | 215 ++++---
 .../system-settings/auth/section-registry.tsx      |  10 +-
 .../system-settings/content/dashboard-section.tsx  |   4 +-
 .../system-settings/general/pricing-section.tsx    |   7 +-
 .../general/system-behavior-section.tsx            |   7 +-
 .../integrations/creem-product-dialog.tsx          |   7 +-
 .../integrations/monitoring-settings-section.tsx   |  14 +-
 .../integrations/payment-settings-section.tsx      | 394 +++++++++++--
 .../waffo-pancake-settings-section.tsx             | 647 +++++++++------------
 .../integrations/waffo-settings-section.tsx        | 201 +++----
 .../maintenance/performance-section.tsx            | 222 +++++--
 .../system-settings/models/grok-settings-card.tsx  |  93 ++-
 .../system-settings/utils/numeric-field.ts         |  91 +++
 .../components/columns/column-helpers.tsx          |  13 +-
 .../components/columns/common-logs-columns.tsx     |  68 ++-
 .../components/columns/drawing-logs-columns.tsx    |   4 +-
 .../components/columns/task-logs-columns.tsx       |   5 +-
 .../features/usage-logs/components/model-badge.tsx |   6 +-
 .../components/usage-logs-mobile-card.tsx          | 402 +++++++++++++
 .../usage-logs/components/usage-logs-table.tsx     |  14 +-
 .../wallet/components/subscription-plans-card.tsx  |   6 +
 web/default/src/features/wallet/index.tsx          |   2 +
 web/default/src/i18n/locales/en.json               |   6 +
 web/default/src/i18n/locales/fr.json               |   6 +
 web/default/src/i18n/locales/ja.json               |   6 +
 web/default/src/i18n/locales/ru.json               |   6 +
 web/default/src/i18n/locales/vi.json               |   6 +
 web/default/src/i18n/locales/zh.json               |   6 +
 web/default/src/i18n/static-keys.ts                |   1 +
 web/default/src/lib/api.ts                         |  62 +-
 web/default/src/lib/currency.ts                    |   2 +-
 web/default/src/lib/theme-customization.ts         |  10 +-
 .../routes/_authenticated/usage-logs/$section.tsx  |   2 +-
 web/default/src/styles/theme-presets.css           | 135 ++++-
 61 files changed, 2850 insertions(+), 1231 deletions(-)

Actions Run

https://github.com/CharyeahOwO/new-api/actions/runs/26481695722

yyhhyyyyyy and others added 16 commits May 26, 2026 10:20
* fix: prevent duplicate channel action toasts

* fix: localize api error fallbacks
- Restore StatusBadge sizes to h-5/text-xs (sm, md) and h-6/text-xs (lg).
- Restore classic textColorMap coloring and status indicator dot.
- Embed channel type icon directly inside StatusBadge as custom children.
- Re-align status badge colors: danger for manual disabled, warning for auto disabled.
… Serif

Adjust PRESET_DEFAULT_FONT so that the shipped 'default' preset falls back to the humanist 'sans' (Public Sans) out-of-the-box instead of forcing the editorial 'serif' (Lora). Keeps the 'anthropic' preset on 'serif' as intended.
…n spacing

- Re-introduce the custom translucent background color and thin border scheme
  for timing and duration badges in common, drawing, and task logs.
- Remove strict max-width constraints on model badges to ensure complete
  names (with version suffixes) are always visible and wrap gracefully.
- Adjust spacing on model and token badges (h-6 height, larger gaps, and
  proper padding) to prevent crowded elements and restore a balanced,
  high-quality look in the log tables.
…inheritance

- Remove explicit 'font-mono' and custom size classes from model and token
  badges in usage logs.
- Allow model name and token badges to naturally inherit the active theme's
  font family (Sans or Serif) and text size from the parent container.
- Restore visual consistency and proportion across all table badge components.
Ensure VChart labels and grid lines use theme-aware colors, and remove oversized rounded corners from ranking bar charts.
Set usage log tables to a balanced 13px default and keep log badges aligned with the active theme font.
…ssues

System settings forms that used flat dotted API keys (e.g.
`performance_setting.monitor_cpu_threshold`) with React Hook Form were
broken: RHF stores dotted paths as nested objects on update, while dirty
checks and submit comparisons still read flat keys from defaults. Users
could edit values but always saw "No changes to save".

Refactor affected sections to use nested Zod schemas and default values
for RHF, with explicit helpers to convert between nested form state and
flat API keys. Track a normalized baseline in refs for accurate change
detection and post-save resets.

Add `safeNumberFieldProps` to prevent native `<input type="number">`
from writing NaN into form state when cleared. NaN caused Zod validation
to fail silently and made the save button appear unresponsive. The
helper ignores non-finite updates so controlled inputs snap back to the
last valid value, matching legacy Semi InputNumber behavior.

Sections refactored for dotted-key handling:
- maintenance/performance-section
- models/grok-settings-card
- auth/passkey-section
- auth/oauth-section
- auth/section-registry (pass attachment_preference raw; normalize in section)

Sections migrated to safeNumberFieldProps:
- maintenance/performance-section
- models/grok-settings-card
- integrations/monitoring-settings-section
- integrations/payment-settings-section
- integrations/creem-product-dialog
- general/pricing-section (USD exchange rate)
- general/system-behavior-section
- content/dashboard-section

Optional numeric fields (e.g. custom currency exchange rate) keep their
existing empty-to-undefined semantics and are intentionally unchanged.
…adge dots

Implement the Simple Large-font theme preset and xl font scale options to enhance interface accessibility. Remove status indicator dots from channel badges in logs to keep the table layout visual and clean.
@github-actions github-actions Bot added upstream-sync Sync updates from upstream risk-medium Medium risk upstream sync ai-reviewed Reviewed by AI labels May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-reviewed Reviewed by AI risk-medium Medium risk upstream sync upstream-sync Sync updates from upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants