-
-
Notifications
You must be signed in to change notification settings - Fork 983
在WebUI界面添加 隐藏/显示 已禁用插件功能 #3122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
在WebUI界面添加 隐藏/显示 已禁用插件功能 #3122
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你好 - 我已经审阅了你的修改,它们看起来很棒!
AI 代理提示
请处理此代码审查中的注释:
## 单独的评论
### 评论 1
<location> `astrbot/dashboard/routes/session_management.py:371-373` </location>
<code_context>
"""获取指定会话的插件配置信息"""
try:
session_id = request.args.get("session_id")
+ hide_disabled = request.args.get("hide_disabled", "false").lower() == "true"
if not session_id:
</code_context>
<issue_to_address>
**建议:** 使用字符串比较解析布尔查询参数可能容易出错。
字符串比较可能无法处理客户端提供的所有可能的布尔表示。请使用专门的解析函数,以便更可靠地处理布尔查询参数。
```suggestion
def parse_bool_query_param(param_value, default=False):
if param_value is None:
return default
if isinstance(param_value, bool):
return param_value
value = str(param_value).strip().lower()
return value in ("true", "1", "yes", "on")
try:
session_id = request.args.get("session_id")
hide_disabled = parse_bool_query_param(request.args.get("hide_disabled"), default=False)
```
</issue_to_address>帮助我更有用!请在每个评论上点击 👍 或 👎,我将使用这些反馈来改进您的评论。
Original comment in English
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `astrbot/dashboard/routes/session_management.py:371-373` </location>
<code_context>
"""获取指定会话的插件配置信息"""
try:
session_id = request.args.get("session_id")
+ hide_disabled = request.args.get("hide_disabled", "false").lower() == "true"
if not session_id:
</code_context>
<issue_to_address>
**suggestion:** Parsing boolean query parameters with string comparison can be error-prone.
String comparison may not handle all possible boolean representations from clients. Use a dedicated parsing function for more reliable handling of boolean query parameters.
```suggestion
def parse_bool_query_param(param_value, default=False):
if param_value is None:
return default
if isinstance(param_value, bool):
return param_value
value = str(param_value).strip().lower()
return value in ("true", "1", "yes", "on")
try:
session_id = request.args.get("session_id")
hide_disabled = parse_bool_query_param(request.args.get("hide_disabled"), default=False)
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| try: | ||
| session_id = request.args.get("session_id") | ||
| hide_disabled = request.args.get("hide_disabled", "false").lower() == "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议: 使用字符串比较解析布尔查询参数可能容易出错。
字符串比较可能无法处理客户端提供的所有可能的布尔表示。请使用专门的解析函数,以便更可靠地处理布尔查询参数。
| try: | |
| session_id = request.args.get("session_id") | |
| hide_disabled = request.args.get("hide_disabled", "false").lower() == "true" | |
| def parse_bool_query_param(param_value, default=False): | |
| if param_value is None: | |
| return default | |
| if isinstance(param_value, bool): | |
| return param_value | |
| value = str(param_value).strip().lower() | |
| return value in ("true", "1", "yes", "on") | |
| try: | |
| session_id = request.args.get("session_id") | |
| hide_disabled = parse_bool_query_param(request.args.get("hide_disabled"), default=False) |
Original comment in English
suggestion: Parsing boolean query parameters with string comparison can be error-prone.
String comparison may not handle all possible boolean representations from clients. Use a dedicated parsing function for more reliable handling of boolean query parameters.
| try: | |
| session_id = request.args.get("session_id") | |
| hide_disabled = request.args.get("hide_disabled", "false").lower() == "true" | |
| def parse_bool_query_param(param_value, default=False): | |
| if param_value is None: | |
| return default | |
| if isinstance(param_value, bool): | |
| return param_value | |
| value = str(param_value).strip().lower() | |
| return value in ("true", "1", "yes", "on") | |
| try: | |
| session_id = request.args.get("session_id") | |
| hide_disabled = parse_bool_query_param(request.args.get("hide_disabled"), default=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么要改这个文件?不是隐藏插件页的已禁用插件吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的呀,我搜索系统自带的 显示系统插件 这个按钮代码就是在这儿,难道改这里有问题吗
而且改完之后我测试了也没问题
|
这个 PR 存在的问题是前端修改的是 /api/plugin/get 路由,但是你却在后端改了 /session/update_plugin 路由。。。你真的测过吗 |
|
此外,如果你要在会话管理隐藏已禁用插件,就应该在会话管理的插件选择对话框中增加相关开关,而不是在插件页。。 |
肯定测试过啊,你看那个截图,我自己用是正常的,难道是你理解错了功能吗。而且那个自带的按钮[显示系统插件]就是这样子写的,我是参考的那个显示系统插件功能写的 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality to hide disabled plugins in both the dashboard frontend (Vue.js) and backend API. The feature allows users to toggle the visibility of disabled plugins in the extension management page.
Key changes:
- Added a new "hide disabled plugins" toggle button in the extension page UI
- Implemented frontend filtering logic to hide/show disabled plugins based on the toggle state
- Added backend API support for filtering disabled plugins (though frontend filtering is used by default)
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dashboard/src/views/ExtensionPage.vue | Added hideDisabled state, toggle function, filtering logic, and UI button for hiding disabled plugins |
| dashboard/src/i18n/locales/zh-CN/features/extension.json | Added Chinese translations for "hide disabled plugins" and "show disabled plugins" buttons |
| astrbot/dashboard/routes/session_management.py | Added hide_disabled query parameter support and filtering logic in get_session_plugins endpoint |
| result = result.filter(ext => !ext.reserved); | ||
| } | ||
| if (!hideDisabled.value) { |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic is inverted. When hideDisabled is false (meaning 'show all plugins'), the code filters to only show activated plugins, which is incorrect. It should be if (hideDisabled.value) to filter out disabled plugins when the toggle is enabled.
| if (!hideDisabled.value) { | |
| if (hideDisabled.value) { |
| import { useI18n, useModuleI18n } from '@/i18n/composables'; | ||
| import {pinyin} from 'pinyin-pro'; | ||
| import {useCommonStore} from '@/stores/common'; | ||
| import {useI18n, useModuleI18n} from '@/i18n/composables'; |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Import formatting changes (removing spaces after braces) are inconsistent with typical JavaScript/Vue style conventions. Most style guides recommend spaces after opening braces in import statements, e.g., import { pinyin } from 'pinyin-pro'. This change appears to be unrelated to the feature being added.
| import {useI18n, useModuleI18n} from '@/i18n/composables'; | |
| import { useI18n, useModuleI18n } from '@/i18n/composables'; |
| import {useI18n, useModuleI18n} from '@/i18n/composables'; | ||
| import { ref, computed, onMounted, reactive } from 'vue'; | ||
| import {computed, onMounted, reactive, ref} from 'vue'; |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The alphabetical reordering of Vue imports and removal of spaces is inconsistent with the typical JavaScript/Vue style conventions and appears unrelated to the feature being added. Consider keeping imports in their original order or applying consistent formatting across the entire file.
fixes #3117
Motivation / 动机
在WebUI界面添加 隐藏/显示 已禁用插件功能
Modifications / 改动点
Sourcery 总结
通过添加一个专门的切换控件、调整客户端过滤逻辑并扩展后端 API 以支持
hide_disabled参数,实现在 WebUI 中隐藏禁用插件的功能。新功能:
hideDisabled状态引入前端过滤hide_disabled参数,并在请求时跳过禁用插件改进:
Original summary in English
Summary by Sourcery
Enable hiding of disabled plugins in the WebUI by adding a dedicated toggle control, adjusting the client-side filtering logic, and extending the backend API to support the hide_disabled parameter.
New Features:
Enhancements: