Skip to content

fix: improve channel test failure details UX - #4988

Merged
seefs001 merged 2 commits into
QuantumNous:mainfrom
yyhhyyyyyy:fix/improve-channel-test-failure-details
May 21, 2026
Merged

fix: improve channel test failure details UX#4988
seefs001 merged 2 commits into
QuantumNous:mainfrom
yyhhyyyyyy:fix/improve-channel-test-failure-details

Conversation

@yyhhyyyyyy

@yyhhyyyyyy yyhhyyyyyy commented May 20, 2026

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

Important

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

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
优化 default 前端测试渠道弹窗的失败状态展示,避免长错误信息撑宽表格或造成移动端多层滚动。失败行现在只展示简短摘要,完整错误通过独立 Sheet 查看,并保留复制能力;同时模型列保持单行展示,操作列固定在右侧,方便用户直接重新测试。

🚀 变更类型 / Type of change

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

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

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

📸 运行证明 / Proof of Work

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

iShot_2026-05-20_15.42.07.mp4

移动端:

iShot_2026-05-20_15.43.25.mp4

Summary by CodeRabbit

  • New Features

    • Failure details sheet for channel tests with copy-to-clipboard raw error info.
    • Enhanced status indicators showing idle/testing/success/failed and opening failure details.
    • Truncated error summaries with optional expanded details and special-case handling.
    • Bulk-action test labeling that reflects selected counts.
  • Accessibility

    • Per-model aria-labels and more consistent localization/accessibility strings.
  • Localization

    • Added/updating test-related UI strings across multiple languages.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9c3cf96d-ab52-48d0-898d-a4310b1dbe23

📥 Commits

Reviewing files that changed from the base of the PR and between f4c4e63 and ef91b70.

📒 Files selected for processing (1)
  • web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx

Walkthrough

Refactors the channel test dialog to add failure-details state, components to show truncated summaries and raw details in a responsive sheet, improved accessibility/localization in the table, and new i18n keys across six locales.

Changes

Channel Test Dialog Enhancement

Layer / File(s) Summary
Failure details state and error formatting
web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx
New failureDetails state and helper functions normalize, truncate, and derive failure summaries (special-casing model_price_error); also centralizes table column class mappings.
Localized table and action controls
web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx
Row checkboxes gain per-model localized aria-labels. "Model" header, "Default" badge, "Status" (now via TestStatusCell), "Actions" header, per-row Test button, and bulk action label are localized (count-aware).
Failure details display components
web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx
Adds TestStatusCell, FailureStatusContent, and FailureDetailsSheet to render idle/testing/success/failure states, open a Sheet with model, summary, and raw details, and provide copy-to-clipboard with dynamic icon state.
Internationalization entries across locales
web/default/src/i18n/locales/{en,fr,ja,ru,vi,zh}.json
Adds translation keys for model-pricing warning, Select model {{model}}, Test, Test {{count}} selected, and Test selected models in six language files.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • QuantumNous/new-api#4876: Modifies the same channel test dialog to improve localized test-failure handling and error text flows.

Suggested reviewers

  • seefs001
  • Calcium-Ion

Poem

🐰 I nibbled bugs and strings today,
I trimmed the errors, made them play.
A sheet unfolds to show the why,
Six tongues now tell the same good try.
Copy, click, the details stay.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 title 'fix: improve channel test failure details UX' directly and accurately describes the main change—refactoring the channel test dialog to improve failure details UX by introducing a dedicated failure-details sheet and preventing long error messages from widening tables.
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

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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx (1)

679-687: ⚡ Quick win

Use named props types and read from props in the new subcomponents.

The new components all inline-destructure their props. Please switch these to named prop types/interfaces and access fields via props.xxx to match the repo convention and keep the prop contracts reusable.

As per coding guidelines, "Do not destructure component props; use props.xxx directly instead for clarity" and "Use functional components with Hooks; ensure single responsibility; explicitly define component prop types with interfaces or type aliases".

Also applies to: 727-735, 784-790, 858-866

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx`
around lines 679 - 687, Replace inline prop destructuring with named prop types
and read from props.xxx: define an explicit props type (e.g., interface
TestStatusCellProps { result?: TestResult; model: string; onOpenDetails:
(details: FailureDetailsState) => void }) and change the TestStatusCell
signature to function TestStatusCell(props: TestStatusCellProps) { ... } using
props.result, props.model, props.onOpenDetails; do the same for the other new
subcomponents in this file that currently destructure props so each has a named
props interface/type and accesses fields via props.xxx to follow the repo
convention and keep prop contracts reusable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx`:
- Around line 633-640: The empty-state messages are raw strings and must be
localized: import and call useTranslation() in the ChannelTestDialog component
(ensure const { t } = useTranslation()), then replace the two literal strings in
the TableCell (the ternary that checks models.length) with t() lookups (e.g.
t('channels.noModelsMatched') and t('channels.noConfiguredModels') or whatever
i18n keys you choose), updating any relevant translation JSONs; keep the
conditional logic and TableCell structure unchanged.
- Around line 575-578: The div in ChannelTestDialog (the element with
role='region' in channel-test-dialog.tsx) has no accessible name; add an
accessible name by adding aria-label={t('Channel models')} or aria-labelledby
pointing to a visible heading inside the region, or remove the role='region' if
the region landmark is unnecessary—update the JSX in the ChannelTestDialog
component accordingly.

In `@web/default/src/i18n/locales/ru.json`:
- Line 3855: Replace the incorrect count-sensitive string "Проверить {{count}}
выбранных" with a grammatically correct count-neutral phrase or use ICU
pluralization; either change the value to "Проверить выбранные ({{count}})" for
a simple fix, or implement ICU plural syntax like "{count, plural, one
{Проверить {count} выбранный} few {Проверить {count} выбранных} many {Проверить
{count} выбранных} other {Проверить {count} выбранных}}" in the same JSON key so
the UI shows correct Russian forms for 1, few, many, and other counts.

---

Nitpick comments:
In
`@web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx`:
- Around line 679-687: Replace inline prop destructuring with named prop types
and read from props.xxx: define an explicit props type (e.g., interface
TestStatusCellProps { result?: TestResult; model: string; onOpenDetails:
(details: FailureDetailsState) => void }) and change the TestStatusCell
signature to function TestStatusCell(props: TestStatusCellProps) { ... } using
props.result, props.model, props.onOpenDetails; do the same for the other new
subcomponents in this file that currently destructure props so each has a named
props interface/type and accesses fields via props.xxx to follow the repo
convention and keep prop contracts reusable.
🪄 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: 37caabda-3af9-43ab-8683-32536839c3db

📥 Commits

Reviewing files that changed from the base of the PR and between 20d3e73 and f4c4e63.

📒 Files selected for processing (7)
  • web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx
  • 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

Comment on lines +633 to +640
<TableRow>
<TableCell
colSpan={table.getVisibleLeafColumns().length}
className='text-muted-foreground h-16 text-center text-sm'
>
{models.length
? 'No models matched your search.'
: 'This channel has no configured models.'}

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

Localize the empty-state copy.

These fallback messages are rendered as raw strings, so they will stay English when the rest of the dialog switches locale.

Suggested fix
-                              {models.length
-                                ? 'No models matched your search.'
-                                : 'This channel has no configured models.'}
+                              {models.length
+                                ? t('No models matched your search.')
+                                : t('This channel has no configured models.')}

As per coding guidelines, "All user-facing text content must support i18n using the t() function from useTranslation() in React components".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<TableRow>
<TableCell
colSpan={table.getVisibleLeafColumns().length}
className='text-muted-foreground h-16 text-center text-sm'
>
{models.length
? 'No models matched your search.'
: 'This channel has no configured models.'}
<TableRow>
<TableCell
colSpan={table.getVisibleLeafColumns().length}
className='text-muted-foreground h-16 text-center text-sm'
>
{models.length
? t('No models matched your search.')
: t('This channel has no configured models.')}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx`
around lines 633 - 640, The empty-state messages are raw strings and must be
localized: import and call useTranslation() in the ChannelTestDialog component
(ensure const { t } = useTranslation()), then replace the two literal strings in
the TableCell (the ternary that checks models.length) with t() lookups (e.g.
t('channels.noModelsMatched') and t('channels.noConfiguredModels') or whatever
i18n keys you choose), updating any relevant translation JSONs; keep the
conditional logic and TableCell structure unchanged.

"Tencent": "Tencent",
"Termination requested": "Запрошено завершение",
"Test": "Проверить",
"Test {{count}} selected": "Проверить {{count}} выбранных",

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 Russian count phrasing on Line 3855 to avoid grammatical errors.

"Проверить {{count}} выбранных" is incorrect for values like 1. Use count-neutral wording (e.g., "Проверить выбранные ({{count}})") or ICU pluralization if supported.

Suggested change
-    "Test {{count}} selected": "Проверить {{count}} выбранных",
+    "Test {{count}} selected": "Проверить выбранные ({{count}})",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/default/src/i18n/locales/ru.json` at line 3855, Replace the incorrect
count-sensitive string "Проверить {{count}} выбранных" with a grammatically
correct count-neutral phrase or use ICU pluralization; either change the value
to "Проверить выбранные ({{count}})" for a simple fix, or implement ICU plural
syntax like "{count, plural, one {Проверить {count} выбранный} few {Проверить
{count} выбранных} many {Проверить {count} выбранных} other {Проверить {count}
выбранных}}" in the same JSON key so the UI shows correct Russian forms for 1,
few, many, and other counts.

@seefs001
seefs001 merged commit 58ba867 into QuantumNous:main May 21, 2026
1 check passed
xyfacai pushed a commit to xyfacai/new-api that referenced this pull request May 30, 2026
* fix: improve channel test failure details UX

* fix: add accessible label to channel models region
SamuelSxy pushed a commit to SamuelSxy/new-api-rh that referenced this pull request Jun 7, 2026
* fix: improve channel test failure details UX

* fix: add accessible label to channel models region
fx247562340 pushed a commit to fx247562340/vancine-platform that referenced this pull request Jun 11, 2026
* fix: improve channel test failure details UX

* fix: add accessible label to channel models region
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
* fix: improve channel test failure details UX

* fix: add accessible label to channel models region
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.

2 participants