diff --git a/astrbot/core/star/command_management.py b/astrbot/core/star/command_management.py index fa9ffef4d..72c88fd30 100644 --- a/astrbot/core/star/command_management.py +++ b/astrbot/core/star/command_management.py @@ -38,6 +38,7 @@ class CommandDescriptor: enabled: bool = True is_group: bool = False is_sub_command: bool = False + reserved: bool = False config: CommandConfig | None = None has_conflict: bool = False sub_commands: list[CommandDescriptor] = field(default_factory=list) @@ -301,6 +302,7 @@ def _build_descriptor(handler: StarHandlerMetadata) -> CommandDescriptor | None: enabled=handler.enabled, is_group=isinstance(filter_ref, CommandGroupFilter), is_sub_command=is_sub_command, + reserved=plugin_meta.reserved if plugin_meta else False, ) return descriptor @@ -437,6 +439,7 @@ def _descriptor_to_dict(desc: CommandDescriptor) -> dict[str, Any]: "enabled": desc.enabled, "is_group": desc.is_group, "has_conflict": desc.has_conflict, + "reserved": desc.reserved, } # 如果是指令组,包含子指令列表 if desc.is_group and desc.sub_commands: diff --git a/dashboard/src/i18n/locales/en-US/features/command.json b/dashboard/src/i18n/locales/en-US/features/command.json index 57af8f35c..a8b249e0f 100644 --- a/dashboard/src/i18n/locales/en-US/features/command.json +++ b/dashboard/src/i18n/locales/en-US/features/command.json @@ -84,6 +84,8 @@ "byPlugin": "Filter by plugin", "byType": "Filter by type", "byPermission": "Filter by permission", - "byStatus": "Filter by status" + "byStatus": "Filter by status", + "showSystemPlugins": "Show system plugins commands", + "systemPluginConflictHint": "System plugin conflicts detected. Resolve conflicts to hide." } } diff --git a/dashboard/src/i18n/locales/zh-CN/features/command.json b/dashboard/src/i18n/locales/zh-CN/features/command.json index 989dd18c3..5eecb9d87 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/command.json +++ b/dashboard/src/i18n/locales/zh-CN/features/command.json @@ -84,6 +84,8 @@ "byPlugin": "按插件筛选", "byType": "按类型筛选", "byPermission": "按权限筛选", - "byStatus": "按状态筛选" + "byStatus": "按状态筛选", + "showSystemPlugins": "显示系统插件指令", + "systemPluginConflictHint": "存在涉及系统插件的冲突,需解决冲突后才能隐藏" } } diff --git a/dashboard/src/views/CommandPage.vue b/dashboard/src/views/CommandPage.vue index e1fbbf0d5..8d28e0d37 100644 --- a/dashboard/src/views/CommandPage.vue +++ b/dashboard/src/views/CommandPage.vue @@ -21,6 +21,7 @@ interface CommandItem { enabled: boolean; is_group: boolean; has_conflict: boolean; + reserved: boolean; // 是否是系统插件的指令 sub_commands: CommandItem[]; } @@ -52,10 +53,21 @@ const pluginFilter = ref('all'); const permissionFilter = ref('all'); const statusFilter = ref('all'); const typeFilter = ref('all'); +const showSystemPlugins = ref(false); // Track expanded groups const expandedGroups = ref>(new Set()); +// 检查是否有涉及系统插件的冲突 +const hasSystemPluginConflict = computed(() => { + return commands.value.some(cmd => cmd.has_conflict && cmd.reserved); +}); + +// 实际是否显示系统插件(如果有系统插件冲突则强制显示) +const effectiveShowSystemPlugins = computed(() => { + return showSystemPlugins.value || hasSystemPluginConflict.value; +}); + // Rename dialog const renameDialog = reactive({ show: false, @@ -81,14 +93,23 @@ const commandHeaders = computed(() => [ { title: tm('table.headers.actions'), key: 'actions', sortable: false, width: '140px' } ]); -// Computed: unique plugins for filter +// Computed: unique plugins for filter (排除系统插件,除非显示系统插件) const availablePlugins = computed(() => { - const plugins = new Set(commands.value.map(cmd => cmd.plugin)); + const plugins = new Set( + commands.value + .filter(cmd => effectiveShowSystemPlugins.value || !cmd.reserved) + .map(cmd => cmd.plugin) + ); return Array.from(plugins).sort(); }); // Helper: check if a command matches filters const matchesFilters = (cmd: CommandItem, query: string): boolean => { + // 系统插件过滤(除非显示系统插件) + if (!effectiveShowSystemPlugins.value && cmd.reserved) { + return false; + } + // Search filter if (query) { const matchesSearch = @@ -426,6 +447,26 @@ onMounted(async () => { {{ tm('summary.disabled') }}: {{ summary.disabled }} + + + + @@ -718,6 +759,14 @@ code.sub-command-code { background-color: rgba(var(--v-theme-secondary), 0.1); color: rgb(var(--v-theme-secondary)); } + +.system-plugin-checkbox { + flex: none; +} + +.system-plugin-checkbox :deep(.v-selection-control) { + min-height: auto; +}