Skip to content

fix(web): 修复新前端订阅额度转换、额度设置保存失败及供应商无法编辑的问题#4598

Open
penguinyzsh wants to merge 8 commits intoQuantumNous:mainfrom
penguinyzsh:fix/default-frontend-bugs
Open

fix(web): 修复新前端订阅额度转换、额度设置保存失败及供应商无法编辑的问题#4598
penguinyzsh wants to merge 8 commits intoQuantumNous:mainfrom
penguinyzsh:fix/default-frontend-bugs

Conversation

@penguinyzsh
Copy link
Copy Markdown

@penguinyzsh penguinyzsh commented May 2, 2026

📝 变更描述 / Description

修复新前端(default frontend)中三个独立的 bug:

1. 订阅套餐总额度显示/存储错误

  • plan-form.tsplanToFormValues()formValuesToPlanPayload() 缺少额度单位转换,导致管理员在新前端创建套餐时输入的金额被当作原始额度单位存储(500000 单位 = $1),用户在钱包页看到的额度严重偏差
  • 新增 quotaUnitsToDollars() / parseQuotaFromDollars() 转换,与经典前端行为保持一致
  • 管理后台套餐列表的总额度列也改为使用 formatQuota() 格式化显示

2. 额度设置页面无法保存(免费模型预消耗等)

根因:quota-settings-section.tsx 中的 Zod schema 使用了扁平的点分隔 key(如 'quota_setting.enable_free_model_pre_consume': z.boolean()),但 useSettingsForm hook 的 expandDotPaths 会将 defaultValues 转换为嵌套对象结构,react-hook-form 也以嵌套结构存储表单值。Zod 校验时找不到对应的扁平 key,导致校验永远失败,表单从来无法保存。

修复:

  • 将 Zod schema 改为嵌套 z.object() 结构,匹配 react-hook-form 的实际数据格式
  • collectDirtyValues 已有递归逻辑,会自动将嵌套的 dirty fields 转换回扁平的点分隔 key 用于 API 调用,无需额外改动
  • URL 字段(TopUpLinkdocs_link)移除 .url() 严格校验,改为 z.string().default('')
  • 修复数字输入框清空时 valueAsNumber 返回 NaN 导致校验失败的问题

3. 模型供应商无法编辑/删除

  • "管理供应商"按钮原本只能打开创建对话框(setOpen('create-vendor')),没有任何 UI 入口查看、编辑或删除已有供应商
  • 新增 VendorManageDialog 供应商管理对话框,点击"管理供应商"后弹出供应商列表,每个供应商提供编辑和删除按钮,底部有新建按钮
  • 关闭编辑/创建对话框后自动返回管理列表
  • 修复 VendorMutateDialog 中硬编码英文字符串,统一使用 t() 国际化
  • 通过 i18n:sync 同步新增翻译至所有 6 种语言

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

  • TypeScript 编译通过(tsc --noEmit 零错误)
  • 生产构建通过(bun run build 成功)
  • 本地完整启动后端 + 前端联调验证
  • bun run i18n:sync 翻译同步通过
  • CodeRabbit 自动审核通过,无 actionable comments

Summary by CodeRabbit

  • New Features
    • Dedicated vendor management dialog with list, create/edit/delete, and interactive vendor cells for quick selection/editing.
  • Enhancements
    • Subscription quota UI now shows formatted totals; plan form converts between dollars and quota units; numeric quota inputs coerce invalid values to 0.
    • Vendor forms use localized submit/toast messages and updated dialog flows.
  • Internationalization
    • Added/updated vendor-related translations across multiple locales (en, fr, ja, ru, vi, zh).

… vendor editing in default frontend

- Add quotaUnitsToDollars/parseQuotaFromDollars conversion in plan-form.ts to match classic frontend behavior
- Format total_amount column with formatQuota() in subscriptions admin table
- Remove strict .url() zod validation on TopUpLink and docs_link that blocks unrelated field saves
- Fix NaN from cleared number inputs by falling back to 0
- Make vendor cells clickable to trigger existing VendorMutateDialog in edit mode
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds vendor management UI (VendorManageDialog, VendorCell) and wiring to open/manage vendors; localizes vendor mutate dialog messages; adds vendor i18n keys and sync-report updates. Also formats subscription quota display and converts quota values between quota-units and dollars; relaxes quota schema and normalizes numeric inputs.

Changes

Vendor Management UI

Layer / File(s) Summary
Data / Types
web/default/src/features/models/components/models-provider.tsx
Adds 'manage-vendors' to the DialogType union.
Core Dialog
web/default/src/features/models/components/dialogs/vendor-manage-dialog.tsx
New VendorManageDialog component: fetches vendors when open, renders list, supports create/edit/delete flows, uses local deleteTarget and React Query for data and invalidation.
Cell UI
web/default/src/features/models/components/models-columns.tsx
Adds VendorCell component rendering vendor icon + StatusBadge inside a clickable button; click sets current vendor and opens update-vendor. Replaces inline vendor rendering in the vendor column.
Dialog Wiring
web/default/src/features/models/components/models-dialogs.tsx, web/default/src/features/models/components/models-primary-buttons.tsx
Renders VendorManageDialog for open === 'manage-vendors'; VendorMutateDialog dismissal now returns to manage-vendors; Manage Vendors action opens manage-vendors.
Mutate Dialog i18n
web/default/src/features/models/components/dialogs/vendor-mutate-dialog.tsx
Localizes toast messages and submit button labels using t(...).
i18n Resources
web/default/src/i18n/locales/*.json, web/default/src/i18n/locales/_reports/_sync-report.json, web/default/src/i18n/locales/_extras/*
Adds/updates vendor-related translation keys across multiple locales; updates sync-report extras/untranslated counts.

Quota & Subscription Handling

Layer / File(s) Summary
Formatting Import
web/default/src/features/subscriptions/components/subscriptions-columns.tsx
Imports formatQuota and uses it to render total_amount when total > 0, preserving the Unlimited fallback.
Form Conversion Helpers
web/default/src/features/subscriptions/lib/plan-form.ts
Imports quotaUnitsToDollars and parseQuotaFromDollars; planToFormValues() converts stored quota-units to dollars (formatted to 2 decimals), formValuesToPlanPayload() converts dollars back to quota-units.
Schema & Normalization
web/default/src/features/system-settings/general/quota-settings-section.tsx
quotaSchema now treats TopUpLink and general_setting.docs_link as plain strings with default(''), nests general_setting/quota_setting, and numeric input handlers coerce NaN from e.target.valueAsNumber to 0 before calling field.onChange.

Sequence Diagram(s)

sequenceDiagram
participant User
participant VendorManageDialog
participant QueryClient
participant API
participant ModelsProvider

User->>VendorManageDialog: open dialog
VendorManageDialog->>QueryClient: fetch vendors (getVendors)
QueryClient->>API: GET /vendors?page_size=1000
API-->>QueryClient: vendors list
QueryClient-->>VendorManageDialog: vendors data
User->>VendorManageDialog: click "Edit" on vendor
VendorManageDialog->>ModelsProvider: setCurrentVendor(vendor)
VendorManageDialog->>ModelsProvider: setOpen('update-vendor')
User->>VendorManageDialog: click "Delete" on vendor
VendorManageDialog->>VendorManageDialog: set deleteTarget
User->>VendorManageDialog: confirm delete
VendorManageDialog->>API: DELETE /vendors/:id
API-->>VendorManageDialog: success
VendorManageDialog->>QueryClient: invalidate vendors list
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • Calcium-Ion
  • seefs001

Poem

🐰 I click the badge and vendors appear,
A modal hums and lists draw near.
Quotas trade units for tidy pay,
Empty links set safe as day.
Hoppity hop — the UI’s clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the three main fixes: subscription quota conversion, quota settings save failures, and vendor edit/delete issues in the new frontend.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/default/src/features/system-settings/general/quota-settings-section.tsx`:
- Around line 28-29: Replace the schema entries that use
z.string().optional().or(z.literal('')) with z.string().default('') so the
inferred types for TopUpLink and 'general_setting.docs_link' are plain string
(not string | undefined), ensuring RHF controlled inputs won’t receive
undefined; update the validators for TopUpLink and 'general_setting.docs_link'
in quota-settings-section.tsx to use z.string().default('') so missing/undefined
server values are coerced to '' and the forms get stable defaultValues.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48968b62-18d5-41e0-9334-af7f708b754f

📥 Commits

Reviewing files that changed from the base of the PR and between dac55f0 and b88d878.

📒 Files selected for processing (4)
  • web/default/src/features/models/components/models-columns.tsx
  • web/default/src/features/subscriptions/components/subscriptions-columns.tsx
  • web/default/src/features/subscriptions/lib/plan-form.ts
  • web/default/src/features/system-settings/general/quota-settings-section.tsx

Comment thread web/default/src/features/system-settings/general/quota-settings-section.tsx Outdated
…view

Replace z.string().optional().or(z.literal('')) with z.string().default('')
to avoid string | undefined type inference and React uncontrolled input warnings.
The useSettingsForm hook's expandDotPaths converts flat dot-path keys
(e.g. 'quota_setting.enable_free_model_pre_consume') into nested objects.
react-hook-form then stores values in this nested structure. But the zod
schema used flat dot-path keys which never matched the nested form data,
causing validation to always fail silently and blocking all saves.

Change the schema to use nested z.object() to match the actual data
structure. The collectDirtyValues function in useSettingsForm already
handles converting nested dirty fields back to flat API keys.
Replace the 'Manage Vendors' button behavior from opening a create-only
dialog to a proper management dialog that lists all vendors with edit
and delete actions per row, plus a create button at the bottom.
Replace the 'Manage Vendors' button behavior from opening a create-only
dialog to a proper management dialog that lists all vendors with edit
and delete actions per row, plus a create button at the bottom.

- Add 'manage-vendors' dialog type and VendorManageDialog component
- Closing vendor create/edit returns to the management list
- Fix hardcoded English strings in VendorMutateDialog with t() calls
- Add missing zh/en/fr/ja/ru/vi translations via i18n:sync
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/default/src/features/models/components/dialogs/vendor-manage-dialog.tsx`:
- Around line 35-69: The UI currently shows the empty-state text while the
vendor query is still loading; update the useQuery call to destructure the
loading flag (e.g., const { data, isLoading } = useQuery(...)) and change the
empty-state render condition to only show when loading is false and
vendors.length === 0 (e.g., !isLoading && vendors.length === 0). Keep the
existing vendors variable and the Dialog render/handlers (vendors, handleEdit,
handleCreate) intact so the only change is adding the isLoading check around the
empty-state message.
- Around line 93-108: The icon-only action Buttons for editing and deleting (the
Button elements that call handleEdit(vendor) and setDeleteTarget(vendor)) lack
accessible names; add descriptive aria-label attributes to each Button (e.g.,
"Edit vendor" and "Delete vendor") and mark the decorative SVG icons (Pencil and
Trash2) as aria-hidden="true" so screen readers use the Button labels, ensuring
keyboard/screen-reader accessibility and preserving existing onClick handlers.

In `@web/default/src/i18n/locales/_reports/_sync-report.json`:
- Line 6: The sync report shows missingCount: 6 for several locales because six
new i18n keys were not registered; add those six keys to the base locale and the
translations (en/fr/ja/ru/vi), then register the same keys in
src/i18n/static-keys.ts (or ensure each string exists as a t('...') literal
somewhere so the extractor picks them up), re-run the extractor with bun run
i18n:sync and repeat until the _sync-report.json missingCount entries are 0.

In `@web/default/src/i18n/locales/fr.json`:
- Line 334: The French locale contains Chinese text values that must be replaced
with proper French translations: locate the key "Are you sure you want to delete
\"{{name}}\"?" (and any other entries in fr.json currently showing Chinese text)
and replace the Chinese string with the correct French translation (e.g.,
"Êtes-vous sûr de vouloir supprimer « {{name}} » ?"), preserving the original
key, interpolation syntax, escaping and JSON formatting; scan the whole fr.json
for similar mixed-language entries and correct them so all values are French.

In `@web/default/src/i18n/locales/ja.json`:
- Line 334: The Japanese locale file (ja.json) contains Chinese translations for
vendor-management strings such as the key "Are you sure you want to delete
\"{{name}}\"?" (and the other affected keys mentioned), so open
web/default/src/i18n/locales/ja.json, locate those English keys (e.g. "Are you
sure you want to delete \"{{name}}\"?") and replace the Chinese values with
correct Japanese translations while keeping the English keys unchanged and
preserving placeholder syntax ({{name}}); ensure all other listed keys (lines
referenced in the comment) are similarly corrected so the ja.json file contains
proper Japanese strings.

In `@web/default/src/i18n/locales/ru.json`:
- Line 334: Several new vendor keys in ru.json are incorrectly translated into
Chinese; replace them with proper Russian translations. Locate the affected keys
(e.g. "Are you sure you want to delete \"{{name}}\"?" and the other five new
vendor keys added in ru.json) and update their values to accurate Russian
strings, ensuring placeholders like {{name}} are preserved and
punctuation/escaping remain intact; then run a quick locale sanity check to
confirm no remaining Chinese entries in ru.json.

In `@web/default/src/i18n/locales/vi.json`:
- Line 334: The Vietnamese locale file vi.json contains Chinese translations for
keys such as "Are you sure you want to delete \"{{name}}\"?" (and other entries
that appear in Chinese); replace the Chinese strings with the correct Vietnamese
translations for those keys in vi.json so the vendor management UI shows
Vietnamese text (locate the entries by the exact source keys like "Are you sure
you want to delete \"{{name}}\"?" and other keys that currently contain Chinese
text and update their values to the proper Vietnamese phrases).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 16d647ad-61d0-4c6a-8491-db30a41f82a5

📥 Commits

Reviewing files that changed from the base of the PR and between 06e9ff1 and 0fa6e66.

📒 Files selected for processing (12)
  • web/default/src/features/models/components/dialogs/vendor-manage-dialog.tsx
  • web/default/src/features/models/components/dialogs/vendor-mutate-dialog.tsx
  • web/default/src/features/models/components/models-dialogs.tsx
  • web/default/src/features/models/components/models-primary-buttons.tsx
  • web/default/src/features/models/components/models-provider.tsx
  • 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
✅ Files skipped from review due to trivial changes (3)
  • web/default/src/features/models/components/dialogs/vendor-mutate-dialog.tsx
  • web/default/src/i18n/locales/zh.json
  • web/default/src/i18n/locales/en.json

Comment thread web/default/src/features/models/components/dialogs/vendor-manage-dialog.tsx Outdated
Comment thread web/default/src/i18n/locales/_reports/_sync-report.json Outdated
"Approx.": "Environ.",
"are also listed here. Remove them from Models to keep the `/v1/models` response user-friendly and hide vendor-specific names.": "sont également listés ici. Supprimez-les des Modèles pour que la réponse `/v1/models` reste conviviale et pour masquer les noms spécifiques aux fournisseurs.",
"Are you sure you want to delete": "Êtes-vous sûr de vouloir supprimer",
"Are you sure you want to delete \"{{name}}\"?": "确定要删除 \"{{name}}\" 吗?",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix mixed-language translations in French locale.

Line 334, Line 886, Line 1000, Line 2319, Line 3753, and Line 3755 currently use Chinese text in fr.json, which causes French UI regression.

🌐 Suggested fix
-    "Are you sure you want to delete \"{{name}}\"?": "确定要删除 \"{{name}}\" 吗?",
+    "Are you sure you want to delete \"{{name}}\"?": "Êtes-vous sûr de vouloir supprimer \"{{name}}\" ?",

-    "Create, edit, or delete vendors": "创建、编辑或删除供应商",
+    "Create, edit, or delete vendors": "Créer, modifier ou supprimer des fournisseurs",

-    "Delete Vendor": "删除供应商",
+    "Delete Vendor": "Supprimer le fournisseur",

-    "No vendors yet": "暂无供应商",
+    "No vendors yet": "Aucun fournisseur pour le moment",

-    "Vendor created successfully": "供应商创建成功",
+    "Vendor created successfully": "Fournisseur créé avec succès",

-    "Vendor updated successfully": "供应商更新成功",
+    "Vendor updated successfully": "Fournisseur mis à jour avec succès",

As per coding guidelines web/default/src/**: “Frontend i18n: Use i18next + react-i18next + i18next-browser-languagedetector. Store translation files as flat JSON at web/default/src/i18n/locales/{lang}.json with English keys.”

Also applies to: 886-886, 1000-1000, 2319-2319, 3753-3753, 3755-3755

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/default/src/i18n/locales/fr.json` at line 334, The French locale contains
Chinese text values that must be replaced with proper French translations:
locate the key "Are you sure you want to delete \"{{name}}\"?" (and any other
entries in fr.json currently showing Chinese text) and replace the Chinese
string with the correct French translation (e.g., "Êtes-vous sûr de vouloir
supprimer « {{name}} » ?"), preserving the original key, interpolation syntax,
escaping and JSON formatting; scan the whole fr.json for similar mixed-language
entries and correct them so all values are French.

Comment thread web/default/src/i18n/locales/ja.json Outdated
"Approx.": "約",
"are also listed here. Remove them from Models to keep the `/v1/models` response user-friendly and hide vendor-specific names.": "もここにリストされています。`/v1/models` レスポンスをユーザーフレンドリーに保ち、ベンダー固有の名前を隠すために、Models からこれらを削除します。",
"Are you sure you want to delete": "削除してもよろしいですか",
"Are you sure you want to delete \"{{name}}\"?": "确定要删除 \"{{name}}\" 吗?",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Japanese locale has Chinese translations for new vendor strings

These values in ja.json are not Japanese, so vendor-management UI text renders in the wrong language.

Proposed fix
-    "Are you sure you want to delete \"{{name}}\"?": "确定要删除 \"{{name}}\" 吗?",
+    "Are you sure you want to delete \"{{name}}\"?": "「{{name}}」を削除してもよろしいですか?",
...
-    "Create, edit, or delete vendors": "创建、编辑或删除供应商",
+    "Create, edit, or delete vendors": "ベンダーの作成・編集・削除",
...
-    "Delete Vendor": "删除供应商",
+    "Delete Vendor": "ベンダーを削除",
...
-    "No vendors yet": "暂无供应商",
+    "No vendors yet": "まだベンダーがありません",
...
-    "Vendor created successfully": "供应商创建成功",
+    "Vendor created successfully": "ベンダーが正常に作成されました",
...
-    "Vendor updated successfully": "供应商更新成功",
+    "Vendor updated successfully": "ベンダーが正常に更新されました",

As per coding guidelines, web/default/src/**: “Store translation files as flat JSON at web/default/src/i18n/locales/{lang}.json with English keys.”

Also applies to: 886-886, 1000-1000, 2319-2319, 3753-3753, 3755-3755

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/default/src/i18n/locales/ja.json` at line 334, The Japanese locale file
(ja.json) contains Chinese translations for vendor-management strings such as
the key "Are you sure you want to delete \"{{name}}\"?" (and the other affected
keys mentioned), so open web/default/src/i18n/locales/ja.json, locate those
English keys (e.g. "Are you sure you want to delete \"{{name}}\"?") and replace
the Chinese values with correct Japanese translations while keeping the English
keys unchanged and preserving placeholder syntax ({{name}}); ensure all other
listed keys (lines referenced in the comment) are similarly corrected so the
ja.json file contains proper Japanese strings.

"Approx.": "Примерно.",
"are also listed here. Remove them from Models to keep the `/v1/models` response user-friendly and hide vendor-specific names.": "также перечислены здесь. Удалите их из Моделей, чтобы ответ `/v1/models` был удобным для пользователя и скрывал имена, специфичные для поставщиков.",
"Are you sure you want to delete": "Вы уверены, что хотите удалить",
"Are you sure you want to delete \"{{name}}\"?": "确定要删除 \"{{name}}\" 吗?",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Russian locale contains Chinese translations for new vendor strings

These six new values are Chinese in ru.json, so Russian users will see mixed-language vendor UI/toasts.

Suggested fix
-    "Are you sure you want to delete \"{{name}}\"?": "确定要删除 \"{{name}}\" 吗?",
+    "Are you sure you want to delete \"{{name}}\"?": "Вы уверены, что хотите удалить \"{{name}}\"?",
...
-    "Create, edit, or delete vendors": "创建、编辑或删除供应商",
+    "Create, edit, or delete vendors": "Создавайте, редактируйте или удаляйте поставщиков",
...
-    "Delete Vendor": "删除供应商",
+    "Delete Vendor": "Удалить поставщика",
...
-    "No vendors yet": "暂无供应商",
+    "No vendors yet": "Поставщиков пока нет",
...
-    "Vendor created successfully": "供应商创建成功",
+    "Vendor created successfully": "Поставщик успешно создан",
...
-    "Vendor updated successfully": "供应商更新成功",
+    "Vendor updated successfully": "Поставщик успешно обновлён",

Also applies to: 886-886, 1000-1000, 2319-2319, 3753-3753, 3755-3755

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/default/src/i18n/locales/ru.json` at line 334, Several new vendor keys in
ru.json are incorrectly translated into Chinese; replace them with proper
Russian translations. Locate the affected keys (e.g. "Are you sure you want to
delete \"{{name}}\"?" and the other five new vendor keys added in ru.json) and
update their values to accurate Russian strings, ensuring placeholders like
{{name}} are preserved and punctuation/escaping remain intact; then run a quick
locale sanity check to confirm no remaining Chinese entries in ru.json.

"Approx.": "Xấp xỉ.",
"are also listed here. Remove them from Models to keep the `/v1/models` response user-friendly and hide vendor-specific names.": "cũng được liệt kê ở đây. Xóa chúng khỏi Models để giữ cho phản hồi `/v1/models` thân thiện với người dùng và ẩn các tên dành riêng cho nhà cung cấp.",
"Are you sure you want to delete": "Bạn có chắc chắn muốn xóa ",
"Are you sure you want to delete \"{{name}}\"?": "确定要删除 \"{{name}}\" 吗?",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Vietnamese locale entries regressed to Chinese text

These updated values in vi.json are Chinese, so Vietnamese users will see mixed-language UI in vendor management flows.

💬 Suggested fix
-    "Are you sure you want to delete \"{{name}}\"?": "确定要删除 \"{{name}}\" 吗?",
+    "Are you sure you want to delete \"{{name}}\"?": "Bạn có chắc chắn muốn xóa \"{{name}}\" không?",
...
-    "Create, edit, or delete vendors": "创建、编辑或删除供应商",
+    "Create, edit, or delete vendors": "Tạo, chỉnh sửa hoặc xóa nhà cung cấp",
...
-    "Delete Vendor": "删除供应商",
+    "Delete Vendor": "Xóa nhà cung cấp",
...
-    "No vendors yet": "暂无供应商",
+    "No vendors yet": "Chưa có nhà cung cấp nào",
...
-    "Vendor created successfully": "供应商创建成功",
+    "Vendor created successfully": "Đã tạo nhà cung cấp thành công",
...
-    "Vendor updated successfully": "供应商更新成功",
+    "Vendor updated successfully": "Đã cập nhật nhà cung cấp thành công",

Also applies to: 886-886, 1000-1000, 2319-2319, 3753-3755

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/default/src/i18n/locales/vi.json` at line 334, The Vietnamese locale file
vi.json contains Chinese translations for keys such as "Are you sure you want to
delete \"{{name}}\"?" (and other entries that appear in Chinese); replace the
Chinese strings with the correct Vietnamese translations for those keys in
vi.json so the vendor management UI shows Vietnamese text (locate the entries by
the exact source keys like "Are you sure you want to delete \"{{name}}\"?" and
other keys that currently contain Chinese text and update their values to the
proper Vietnamese phrases).

…ale fixes

- Show empty state only after loading completes
- Add aria-label to icon-only edit/delete buttons
- Fix fr/ja/ru/vi translations that were incorrectly filled with Chinese
@penguinyzsh
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@penguinyzsh
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
web/default/src/i18n/locales/ja.json (1)

886-886: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Replace the remaining Chinese vendor strings with Japanese translations.

These entries are still Chinese, so the new vendor-management UI will render the wrong language for Japanese users.

Also applies to: 1000-1000, 2319-2319, 3753-3755

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/default/src/i18n/locales/ja.json` at line 886, Replace the Chinese
translations for the vendor-related JSON keys with proper Japanese strings:
locate the key "Create, edit, or delete vendors" (and the other vendor-related
keys flagged in the review) and replace the value "创建、编辑或删除供应商" with the correct
Japanese translation; do the same for the other occurrences noted (the entries
at the other flagged locations) so all vendor-management UI strings in ja.json
are Japanese rather than Chinese.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/default/src/i18n/locales/_extras/ja.extras.json`:
- Around line 2-7: The ja.extras.json file only contains a subset of strings
used by VendorMutateDialog and VendorManageDialog; add translations for all
remaining vendor-facing keys referenced by those components (labels, buttons
like "Create vendor", "Update vendor", "Cancel", "Confirm", form field labels,
validation/error messages, list headers, and any pluralization keys) so the
dialogs don't mix English/Japanese; preserve interpolation tokens (e.g.,
"{{name}}") and escaping/quoting exactly as in existing entries and mirror the
English keys' keys/names used by VendorMutateDialog and VendorManageDialog when
adding the Japanese values.

---

Duplicate comments:
In `@web/default/src/i18n/locales/ja.json`:
- Line 886: Replace the Chinese translations for the vendor-related JSON keys
with proper Japanese strings: locate the key "Create, edit, or delete vendors"
(and the other vendor-related keys flagged in the review) and replace the value
"创建、编辑或删除供应商" with the correct Japanese translation; do the same for the other
occurrences noted (the entries at the other flagged locations) so all
vendor-management UI strings in ja.json are Japanese rather than Chinese.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 06f55172-e28e-4a58-a563-220e02525684

📥 Commits

Reviewing files that changed from the base of the PR and between 0335274 and 13d5ec4.

📒 Files selected for processing (12)
  • web/default/src/i18n/locales/_extras/fr.extras.json
  • web/default/src/i18n/locales/_extras/ja.extras.json
  • web/default/src/i18n/locales/_extras/ru.extras.json
  • web/default/src/i18n/locales/_extras/vi.extras.json
  • web/default/src/i18n/locales/_reports/_sync-report.json
  • web/default/src/i18n/locales/_reports/ja.untranslated.json
  • web/default/src/i18n/locales/_reports/ru.untranslated.json
  • web/default/src/i18n/locales/_reports/zh.untranslated.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
✅ Files skipped from review due to trivial changes (5)
  • web/default/src/i18n/locales/_reports/ja.untranslated.json
  • web/default/src/i18n/locales/_reports/ru.untranslated.json
  • web/default/src/i18n/locales/_extras/vi.extras.json
  • web/default/src/i18n/locales/_extras/fr.extras.json
  • web/default/src/i18n/locales/vi.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/fr.json

Comment on lines +2 to +7
"Are you sure you want to delete \"{{name}}\"?": "\"{{name}}\" を削除してもよろしいですか?",
"Create, edit, or delete vendors": "ベンダーの作成、編集、削除",
"Delete Vendor": "ベンダーを削除",
"No vendors yet": "ベンダーはまだありません",
"Vendor created successfully": "ベンダーを作成しました",
"Vendor updated successfully": "ベンダーを更新しました"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fill in the remaining vendor-dialog translations.

This file only adds a small subset of the keys used by VendorMutateDialog and VendorManageDialog, so the dialogs will still render a mix of Japanese and English. Please sync the rest of the vendor-facing strings here as well, or confirm that the fallback behavior is intentional.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/default/src/i18n/locales/_extras/ja.extras.json` around lines 2 - 7, The
ja.extras.json file only contains a subset of strings used by VendorMutateDialog
and VendorManageDialog; add translations for all remaining vendor-facing keys
referenced by those components (labels, buttons like "Create vendor", "Update
vendor", "Cancel", "Confirm", form field labels, validation/error messages, list
headers, and any pluralization keys) so the dialogs don't mix English/Japanese;
preserve interpolation tokens (e.g., "{{name}}") and escaping/quoting exactly as
in existing entries and mirror the English keys' keys/names used by
VendorMutateDialog and VendorManageDialog when adding the Japanese values.

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