fix: support numeric status code mapping in ResetStatusCode - #2926
Conversation
WalkthroughAdds robust JSON parsing for status-code mappings with tests; adjusts header passthrough/override behavior during channel tests and corresponding tests; excludes manually disabled channels from "test all channels" flows and updates UI text/translations; minor tokens pagination/input normalization and form submit fixes. Changes
Sequence Diagram(s)mermaid Client->>Relay: HTTP request with headers + info (IsChannelTest?) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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
🤖 Fix all issues with AI agents
In `@web/src/components/table/channels/ChannelsActions.jsx`:
- Around line 102-109: The success toast in useChannelsData.jsx (around the
success handler that runs after testAllChannels) uses wording
"已成功开始测试所有已启用通道..." which conflicts with the button/confirm text "未手动禁用渠道";
update the toast message to the matching semantics by replacing the translation
key/value with wording like "已成功开始测试所有未手动禁用渠道,请刷新页面查看结果。" (or add a new i18n key
and use that) in the success handler that is triggered by testAllChannels() so
the toast matches the confirmation/button text.
| content: t('确定要测试所有未手动禁用渠道吗?'), | ||
| onOk: () => testAllChannels(), | ||
| size: 'small', | ||
| centered: true, | ||
| }); | ||
| }} | ||
| > | ||
| {t('测试所有通道')} | ||
| {t('测试所有未手动禁用渠道')} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Locate useChannelsData.jsx and check the success message
find . -name "useChannelsData.jsx" -type fRepository: QuantumNous/new-api
Length of output: 107
🏁 Script executed:
# Search for the success message mentioned in the review
rg -n '已成功开始测试所有已启用通道' --type=js --type=jsx -C 3Repository: QuantumNous/new-api
Length of output: 90
🏁 Script executed:
# Also search for the button/confirmation text changes
rg -n '确定要测试所有未手动禁用渠道' --type=js --type=jsx -C 2
rg -n '测试所有未手动禁用渠道' --type=js --type=jsx -C 2Repository: QuantumNous/new-api
Length of output: 118
🏁 Script executed:
# Check for any related success message keys in locale files
rg -n '已成功开始测试所有' --type=json -C 1Repository: QuantumNous/new-api
Length of output: 3537
🏁 Script executed:
#!/bin/bash
# Search useChannelsData.jsx for the success message usage
rg -n '已成功开始测试所有已启用通道' ./web/src/hooks/channels/useChannelsData.jsx -C 3Repository: QuantumNous/new-api
Length of output: 297
🏁 Script executed:
# Search for any new success message key with "未手动禁用"
rg -n '未手动禁用' ./web/src/i18n/locales/ --type=jsonRepository: QuantumNous/new-api
Length of output: 1601
🏁 Script executed:
# Check the actual ChannelsActions.jsx file to confirm button changes
cat -n ./web/src/components/table/channels/ChannelsActions.jsx | sed -n '95,115p'Repository: QuantumNous/new-api
Length of output: 948
Update success message to match button semantics in useChannelsData.jsx:720.
The button and confirmation now say "未手动禁用渠道" (channels except manually disabled), but the success toast still uses t('已成功开始测试所有已启用通道,请刷新页面查看结果。') which says "enabled channels". These have different semantics—"not manually disabled" includes system-disabled channels while "enabled" does not. Update the success message to use consistent terminology with the button/confirmation dialogs.
🤖 Prompt for AI Agents
In `@web/src/components/table/channels/ChannelsActions.jsx` around lines 102 -
109, The success toast in useChannelsData.jsx (around the success handler that
runs after testAllChannels) uses wording "已成功开始测试所有已启用通道..." which conflicts
with the button/confirm text "未手动禁用渠道"; update the toast message to the matching
semantics by replacing the translation key/value with wording like
"已成功开始测试所有未手动禁用渠道,请刷新页面查看结果。" (or add a new i18n key and use that) in the
success handler that is triggered by testAllChannels() so the toast matches the
confirmation/button text.
…ping fix: support numeric status code mapping in ResetStatusCode
Summary by CodeRabbit
Bug Fixes
Tests
UI
Localization
Improvements