Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
你好——我在这里给了一些整体性的反馈:
- 在
StarManager.reinstall_failed_plugin中,缺少仓库地址时使用了硬编码的中文错误信息("失败插件缺少仓库地址,无法重新安装。"),绕过了format_plugin_error,导致和其他错误文案以及 i18n 机制不一致;建议新增一个专门的错误 key,并通过format_plugin_error来生成错误信息。 PluginRoute.reinstall_failed_plugin处理器直接从后端返回了一条中文成功消息("重新安装成功。"),而前端已经有本地化的 toast 文案;建议要么前端不要依赖后端返回的消息、复用已有的本地化文案,要么在后端对这类响应信息进行标准化,使其符合现有的 i18n 方式。
面向 AI 代理的提示词
Please address the comments from this code review:
## Overall Comments
- In `StarManager.reinstall_failed_plugin`, the hard-coded Chinese error message for missing repo (`"失败插件缺少仓库地址,无法重新安装。"`) bypasses `format_plugin_error` and breaks consistency with other error strings and i18n; consider adding a dedicated error key and using `format_plugin_error` instead.
- The `PluginRoute.reinstall_failed_plugin` handler returns a Chinese success message (`"重新安装成功。"`) directly from the backend while the frontend already has localized toast texts; either reuse the localized frontend strings by not relying on backend messages, or standardize this response message to match the existing i18n approach.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English
Hey - I've left some high level feedback:
- In
StarManager.reinstall_failed_plugin, the hard-coded Chinese error message for missing repo ("失败插件缺少仓库地址,无法重新安装。") bypassesformat_plugin_errorand breaks consistency with other error strings and i18n; consider adding a dedicated error key and usingformat_plugin_errorinstead. - The
PluginRoute.reinstall_failed_pluginhandler returns a Chinese success message ("重新安装成功。") directly from the backend while the frontend already has localized toast texts; either reuse the localized frontend strings by not relying on backend messages, or standardize this response message to match the existing i18n approach.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `StarManager.reinstall_failed_plugin`, the hard-coded Chinese error message for missing repo (`"失败插件缺少仓库地址,无法重新安装。"`) bypasses `format_plugin_error` and breaks consistency with other error strings and i18n; consider adding a dedicated error key and using `format_plugin_error` instead.
- The `PluginRoute.reinstall_failed_plugin` handler returns a Chinese success message (`"重新安装成功。"`) directly from the backend while the frontend already has localized toast texts; either reuse the localized frontend strings by not relying on backend messages, or standardize this response message to match the existing i18n approach.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f806d7ef9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if dir_name not in self.failed_plugin_dict: | ||
| restored_info = failed_info_snapshot | ||
| if isinstance(restored_info, dict): | ||
| restored_info["error"] = str(e) | ||
| restored_info["traceback"] = traceback.format_exc() |
There was a problem hiding this comment.
Avoid restoring stale failed entry after reinstall cleanup
When reinstall_failed_plugin catches an exception, this block restores failed_plugin_dict[dir_name] from the snapshot without verifying the plugin directory still exists. In the failure path where remove_dir(plugin_path) has already run and install_plugin fails before creating a new checkout (for example, a network failure in updator.install), the manager now advertises a failed plugin that has no on-disk directory; a later reload_failed_plugin call will report success and drop the record even though nothing was reinstalled. This leaves plugin state inconsistent and gives a false-success recovery flow.
Useful? React with 👍 / 👎.
# Conflicts: # astrbot/core/star/star_manager.py
Closes #6021
本次改动为失败插件列表补充“重新安装”能力,并完善重装过程中的前端提示反馈,解决失败插件只能“重载 / 卸载”、且重装过程中缺少状态提示的问题。
Modifications / 改动点
repo重新拉取插件源码并重新安装。文件变更统计:
详细变更:
astrbot/core/star/star_manager.pyastrbot/dashboard/routes/plugin.pydashboard/src/views/extension/useExtensionPage.jsdashboard/src/views/extension/InstalledPluginsTab.vuedashboard/src/i18n/locales/zh-CN/features/extension.jsondashboard/src/i18n/locales/en-US/features/extension.jsontests/test_plugin_manager.pyScreenshots or Test Results / 运行截图或测试结果
验证步骤:
/extension#installed的失败插件列表页面。astrbot_plugin_self_code验证重新安装成功。测试结果:
运行视频:
test.mp4
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Sourcery 总结
添加对使用插件原始仓库源重新安装失败插件的支持,并通过仪表板 UI 和 API 暴露这一流程。
新功能:
错误修复:
测试:
Original summary in English
Summary by Sourcery
Add support for reinstalling failed plugins using their original repository source and expose this flow through the dashboard UI and API.
New Features:
Bug Fixes:
Tests: