fix(web): 修复新前端订阅额度转换、额度设置保存失败及供应商无法编辑的问题#4598
fix(web): 修复新前端订阅额度转换、额度设置保存失败及供应商无法编辑的问题#4598penguinyzsh wants to merge 8 commits intoQuantumNous:mainfrom
Conversation
… 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
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds 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. ChangesVendor Management UI
Quota & Subscription Handling
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
web/default/src/features/models/components/models-columns.tsxweb/default/src/features/subscriptions/components/subscriptions-columns.tsxweb/default/src/features/subscriptions/lib/plan-form.tsweb/default/src/features/system-settings/general/quota-settings-section.tsx
…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
There was a problem hiding this comment.
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
📒 Files selected for processing (12)
web/default/src/features/models/components/dialogs/vendor-manage-dialog.tsxweb/default/src/features/models/components/dialogs/vendor-mutate-dialog.tsxweb/default/src/features/models/components/models-dialogs.tsxweb/default/src/features/models/components/models-primary-buttons.tsxweb/default/src/features/models/components/models-provider.tsxweb/default/src/i18n/locales/_reports/_sync-report.jsonweb/default/src/i18n/locales/en.jsonweb/default/src/i18n/locales/fr.jsonweb/default/src/i18n/locales/ja.jsonweb/default/src/i18n/locales/ru.jsonweb/default/src/i18n/locales/vi.jsonweb/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
| "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}}\" 吗?", |
There was a problem hiding this comment.
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.
| "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}}\" 吗?", |
There was a problem hiding this comment.
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}}\" 吗?", |
There was a problem hiding this comment.
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}}\" 吗?", |
There was a problem hiding this comment.
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
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
web/default/src/i18n/locales/ja.json (1)
886-886:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winReplace 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
📒 Files selected for processing (12)
web/default/src/i18n/locales/_extras/fr.extras.jsonweb/default/src/i18n/locales/_extras/ja.extras.jsonweb/default/src/i18n/locales/_extras/ru.extras.jsonweb/default/src/i18n/locales/_extras/vi.extras.jsonweb/default/src/i18n/locales/_reports/_sync-report.jsonweb/default/src/i18n/locales/_reports/ja.untranslated.jsonweb/default/src/i18n/locales/_reports/ru.untranslated.jsonweb/default/src/i18n/locales/_reports/zh.untranslated.jsonweb/default/src/i18n/locales/fr.jsonweb/default/src/i18n/locales/ja.jsonweb/default/src/i18n/locales/ru.jsonweb/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
| "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": "ベンダーを更新しました" |
There was a problem hiding this comment.
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.
📝 变更描述 / Description
修复新前端(default frontend)中三个独立的 bug:
1. 订阅套餐总额度显示/存储错误
plan-form.ts中planToFormValues()和formValuesToPlanPayload()缺少额度单位转换,导致管理员在新前端创建套餐时输入的金额被当作原始额度单位存储(500000 单位 = $1),用户在钱包页看到的额度严重偏差quotaUnitsToDollars()/parseQuotaFromDollars()转换,与经典前端行为保持一致formatQuota()格式化显示2. 额度设置页面无法保存(免费模型预消耗等)
根因:
quota-settings-section.tsx中的 Zod schema 使用了扁平的点分隔 key(如'quota_setting.enable_free_model_pre_consume': z.boolean()),但useSettingsFormhook 的expandDotPaths会将 defaultValues 转换为嵌套对象结构,react-hook-form 也以嵌套结构存储表单值。Zod 校验时找不到对应的扁平 key,导致校验永远失败,表单从来无法保存。修复:
z.object()结构,匹配 react-hook-form 的实际数据格式collectDirtyValues已有递归逻辑,会自动将嵌套的 dirty fields 转换回扁平的点分隔 key 用于 API 调用,无需额外改动TopUpLink、docs_link)移除.url()严格校验,改为z.string().default('')valueAsNumber返回NaN导致校验失败的问题3. 模型供应商无法编辑/删除
setOpen('create-vendor')),没有任何 UI 入口查看、编辑或删除已有供应商VendorManageDialog供应商管理对话框,点击"管理供应商"后弹出供应商列表,每个供应商提供编辑和删除按钮,底部有新建按钮VendorMutateDialog中硬编码英文字符串,统一使用t()国际化i18n:sync同步新增翻译至所有 6 种语言🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
无
✅ 提交前检查项 / Checklist
📸 运行证明 / Proof of Work
tsc --noEmit零错误)bun run build成功)bun run i18n:sync翻译同步通过Summary by CodeRabbit