Skip to content

Feat/chinese only - #5522

Closed
yunlongwen wants to merge 16 commits into
QuantumNous:mainfrom
yunlongwen:feat/chinese-only
Closed

yunlongwen wants to merge 16 commits into
QuantumNous:mainfrom
yunlongwen:feat/chinese-only

Conversation

@yunlongwen

@yunlongwen yunlongwen commented Jun 15, 2026 •

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

Release Notes

  • New Features

    • Dashboard now supports toggling user ranking metrics between "Cost Consumption" and "Call Count"
    • Added pricing configuration interface for administrators to edit model pricing
  • Changes

    • Interface now available in Chinese only; language switcher removed from all pages
    • Homepage redesigned with updated branding and messaging
    • Updated dashboard statistics and feature descriptions
    • Simplified footer layout
    • Removed language preferences from profile settings

Drop the convention rule that forbade modifying new-api/QuantumNous branding; renumber remaining rules (now Rules 1-7).
The project attribution was force-rendered alongside any custom footer set in System Settings, so the admin-configured Footer field could never show clean. Remove the ProjectAttribution component and its render sites.
Rewrite Hero/Features/Stats/HowItWorks/CTA to target relay end-users (models, pricing, stability, easy setup, sign-up bonus) instead of framework operators. Add zh.json translations. Model chips switched to domestic (GLM/DeepSeek/MiniMax/Kimi/Tongyi/Doubao).
Drop the hardcoded 'Designed by New API' line from both classic footer branches, matching the default theme.
Add an admin-only Edit Pricing entry in the default theme model detail drawer. Edits ModelRatio/CompletionRatio/ModelPrice via PUT /api/option/ (reuses system-settings option API); changes take effect immediately because the backend refreshes in-memory ratio maps on each PUT. Plaza data is refetched on save.
… count

Add a metric switch (费用消耗/调用次数) to the User Analytics ranking page.
Switching re-selects Top N users, the ranking bar chart, and the trend
chart to the chosen metric (count or quota). Default stays on quota,
preserving prior behavior. Frontend-only; backend already returns sum(count).
Drop the '文档'/Docs CTA from the landing hero (both guest and
authenticated states), keeping only Get Started + View Pricing (guest)
and Go to Dashboard (auth). Removes the now-dead renderDocsButton
helper, docsUrl, and unused BookOpen/useStatus imports.
feat(home): remove Docs button from homepage hero
Center the custom footer block (drop desktop left-align) and render its
content with the shared Markdown component (react-markdown + remark-gfm +
rehype-raw), so admins can write links like [ICP](https://beian.miit.gov.cn).
External links open in a new tab. Update the Footer field description
(en/zh) to hint Markdown support. Default multi-column footer unchanged.
feat(footer): center footer content and render Markdown links
Drop the logo + system name + 'Powerful API Management Platform'
brand block from the default (non-custom) footer, leaving just the
copyright/legal row. Tighten the footer padding and remove the now-
unused displayLogo/systemLogo. Demo-mode link columns are unaffected.
chore(footer): remove brand column from default footer
Force i18next to a single language (lng/fallbackLng/supportedLngs = zh),
drop the browser language detector, and delete the en/fr/ja/ru/vi locale
files. Remove all language-switching UI (header switcher, setup wizard,
profile language-preferences card) and the now-unused language-switcher,
language-preferences-card, and i18n/languages modules. README rewritten
to a minimal Chinese note (clone source + customization log); other
language READMEs removed. zh.json content unchanged; t('English key')
still resolves to Chinese. Backend i18n untouched.
@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe981a64-c40e-4204-aaeb-a31604aa1096

📥 Commits

Reviewing files that changed from the base of the PR and between 9bc1a53 and 7e4f397.

📒 Files selected for processing (34)
  • CLAUDE.md
  • README.en.md
  • README.fr.md
  • README.ja.md
  • README.md
  • README.zh_CN.md
  • README.zh_TW.md
  • web/classic/src/components/layout/Footer.jsx
  • web/default/src/components/language-switcher.tsx
  • web/default/src/components/layout/components/app-header.tsx
  • web/default/src/components/layout/components/footer.tsx
  • web/default/src/components/layout/components/public-header.tsx
  • web/default/src/features/dashboard/components/users/user-charts.tsx
  • web/default/src/features/dashboard/lib/charts.ts
  • web/default/src/features/dashboard/types.ts
  • web/default/src/features/home/components/sections/cta.tsx
  • web/default/src/features/home/components/sections/features.tsx
  • web/default/src/features/home/components/sections/hero.tsx
  • web/default/src/features/home/components/sections/how-it-works.tsx
  • web/default/src/features/home/components/sections/stats.tsx
  • web/default/src/features/pricing/components/edit-pricing-dialog.tsx
  • web/default/src/features/pricing/components/model-details.tsx
  • web/default/src/features/profile/components/language-preferences-card.tsx
  • web/default/src/features/profile/index.tsx
  • web/default/src/features/setup/setup-wizard.tsx
  • web/default/src/i18n/config.ts
  • web/default/src/i18n/languages.ts
  • web/default/src/i18n/locales/_reports/_sync-report.json
  • web/default/src/i18n/locales/en.json
  • web/default/src/i18n/locales/fr.json
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/vi.json
  • web/default/src/i18n/locales/zh.json

Walkthrough

This PR customizes new-api as a Chinese-only "PaopaoApi" fork: i18n is locked to zh, all LanguageSwitcher surfaces and the LanguagePreferencesCard are removed, home-page sections are rebranded with PaopaoApi copy, the footer attribution is replaced with a system-name copyright, a dashboard metric toggle (quota vs. call count) is added to user charts, an admin EditPricingDialog is added for per-model pricing, and all non-Chinese README files are cleared.

Changes

New Features: Dashboard Metric Switcher & Edit Pricing Dialog

Layer / File(s) Summary
UserRankMetric type
web/default/src/features/dashboard/types.ts
Exports UserRankMetric = 'quota' | 'count' for metric-aware chart processing.
processUserChartData metric logic
web/default/src/features/dashboard/lib/charts.ts
Adds metric parameter with isCount/valueOf helpers; switches all per-user aggregation, ranking, trend titles, and Usage computation to be metric-aware.
UserCharts metric Tabs UI
web/default/src/features/dashboard/components/users/user-charts.tsx
Adds metric state, Tabs selector, passes metric to processUserChartData, updates useMemo deps, and refreshes VChart key on metric change.
EditPricingDialog implementation
web/default/src/features/pricing/components/edit-pricing-dialog.tsx
Full dialog for per-model pricing: fetches/parses ModelRatio, CompletionRatio, ModelPrice maps, per-token/per-request mode toggle, validates and saves via updateSystemOption, toast feedback.
ModelHeader admin Edit Pricing wiring
web/default/src/features/pricing/components/model-details.tsx
Adds isAdmin guard and editOpen state; renders admin-only "Edit Pricing" button that opens EditPricingDialog and refetches pricing on save.
zh.json keys for new features
web/default/src/i18n/locales/zh.json
Adds pricing edit UI strings, Call Count / Cost Consumption labels, User Call Count Ranking/Trend titles, and per-request fixed-price label adjustments.

PaopaoApi Rebrand: i18n Lockdown, Home Page, Footer & Docs

Layer / File(s) Summary
i18n locked to zh-only
web/default/src/i18n/config.ts, web/default/src/i18n/languages.ts
Removes language detection and multi-language resources; forces lng/fallbackLng/supportedLngs to 'zh'. Deletes languages.ts including INTERFACE_LANGUAGE_OPTIONS, InterfaceLanguageCode, and normalizeInterfaceLanguage.
LanguageSwitcher removed from all UI surfaces
web/default/src/components/language-switcher.tsx, web/default/src/components/layout/components/app-header.tsx, web/default/src/components/layout/components/public-header.tsx, web/default/src/features/setup/setup-wizard.tsx, web/default/src/features/profile/...
Removes LanguageSwitcher component and all render sites (AppHeader, PublicHeader, SetupWizard); removes showLanguageSwitcher prop from PublicHeaderProps; removes LanguagePreferencesCard from Profile page.
Footer layout and attribution
web/classic/src/components/layout/Footer.jsx, web/default/src/components/layout/components/footer.tsx
Classic footer replaces "New API" link with system-name copyright; default footer switches footerHtml to <Markdown> renderer, removes brand column and project attribution from demo layout.
Home page sections rebranded
web/default/src/features/home/components/sections/*
Hero pill/headline updated, docs button removed; Features section cards and section heading replaced with PaopaoApi copy; CTA, HowItWorks, and Stats content all updated to PaopaoApi messaging.
README files cleared and CLAUDE.md updated
README.md, README.en.md, README.fr.md, README.ja.md, README.zh_CN.md, README.zh_TW.md, CLAUDE.md, web/default/src/i18n/locales/_reports/_sync-report.json
README.md intro replaced with Chinese fork header; all other language README files cleared; CLAUDE.md rules renumbered (Rules 5–7); locale sync report emptied.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • QuantumNous/new-api#4876: Modifies the same LanguageSwitcher component and web/default/src/i18n/languages.ts / config.ts files involved in this PR's language-switcher removal and i18n lockdown.
  • QuantumNous/new-api#2913: Adds the same multilingual README files (README.zh_TW.md, README.zh_CN.md, etc.) that this PR clears, plus zh_TW/zh-CN UI language support that is now removed.

Poem

🐇 One tongue to rule them all, says the rabbit with a hop,
The language chooser vanished—gone without a stop!
Now PaopaoApi gleams in Chinese characters bright,
Count calls or quota spent? A tab to set it right.
The pricing admin taps, the dialog appears—
"Edit Pricing" bows, the repo customization cheers! 🥕

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yunlongwen yunlongwen closed this Jun 15, 2026
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.

1 participant