diff --git a/astrbot/core/star/command_management.py b/astrbot/core/star/command_management.py index 72c88fd30..c823695b4 100644 --- a/astrbot/core/star/command_management.py +++ b/astrbot/core/star/command_management.py @@ -30,7 +30,7 @@ class CommandDescriptor: raw_command_name: str | None = None current_fragment: str | None = None parent_signature: str = "" - parent_group_handler: str = "" # 父指令组的 handler_full_name + parent_group_handler: str = "" original_command: str | None = None effective_command: str | None = None aliases: list[str] = field(default_factory=list) diff --git a/dashboard/src/i18n/locales/en-US/features/extension.json b/dashboard/src/i18n/locales/en-US/features/extension.json index b1ec35191..4a9884533 100644 --- a/dashboard/src/i18n/locales/en-US/features/extension.json +++ b/dashboard/src/i18n/locales/en-US/features/extension.json @@ -173,5 +173,11 @@ "errors": { "confirmNotRegistered": "$confirm not properly registered" } + }, + "conflicts": { + "title": "Command Conflicts Detected", + "message": "This may cause some commands to not work properly. It is recommended to go to Command Management to resolve.", + "pairs": "command conflicts", + "goToManage": "Go to Manage" } } diff --git a/dashboard/src/i18n/locales/zh-CN/features/extension.json b/dashboard/src/i18n/locales/zh-CN/features/extension.json index 4b7a8058f..b33922ae5 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/extension.json +++ b/dashboard/src/i18n/locales/zh-CN/features/extension.json @@ -173,5 +173,11 @@ "errors": { "confirmNotRegistered": "$confirm 未正确注册" } + }, + "conflicts": { + "title": "检测到指令冲突", + "message": "这可能导致部分指令无法正常工作,建议前往指令管理页面处理。", + "pairs": "对指令冲突", + "goToManage": "前往处理" } } diff --git a/dashboard/src/views/ExtensionPage.vue b/dashboard/src/views/ExtensionPage.vue index a9dec0679..97b3d0996 100644 --- a/dashboard/src/views/ExtensionPage.vue +++ b/dashboard/src/views/ExtensionPage.vue @@ -11,12 +11,37 @@ import { useCommonStore } from '@/stores/common'; import { useI18n, useModuleI18n } from '@/i18n/composables'; import defaultPluginIcon from '@/assets/images/plugin_icon.png'; -import { ref, computed, onMounted, reactive, inject, watch } from 'vue'; - +import { ref, computed, onMounted, reactive, watch } from 'vue'; +import { useRouter } from 'vue-router'; const commonStore = useCommonStore(); const { t } = useI18n(); const { tm } = useModuleI18n('features/extension'); +const router = useRouter(); + +// 检查指令冲突并提示 +const conflictDialog = reactive({ + show: false, + count: 0 +}); +const checkAndPromptConflicts = async () => { + try { + const res = await axios.get('/api/commands'); + if (res.data.status === 'ok') { + const conflicts = res.data.data.summary?.conflicts || 0; + if (conflicts > 0) { + conflictDialog.count = conflicts; + conflictDialog.show = true; + } + } + } catch (err) { + console.debug('Failed to check command conflicts:', err); + } +}; +const handleConflictConfirm = () => { + router.push('/commands'); +}; + const fileInput = ref(null); const activeTab = ref('installed'); const extension_data = reactive({ @@ -435,7 +460,9 @@ const pluginOn = async (extension) => { return; } toast(res.data.message, "success"); - getExtensions(); + await getExtensions(); + + await checkAndPromptConflicts(); } catch (err) { toast(err, "error"); } @@ -618,6 +645,8 @@ const newExtension = async () => { name: res.data.data.name, repo: res.data.data.repo || null }); + + await checkAndPromptConflicts(); }).catch((err) => { loading_.value = false; onLoadingDialogResult(2, err, -1); @@ -644,6 +673,8 @@ const newExtension = async () => { name: res.data.data.name, repo: res.data.data.repo || null }); + + await checkAndPromptConflicts(); }).catch((err) => { loading_.value = false; toast(tm('messages.installFailed') + " " + err, "error"); @@ -1222,6 +1253,34 @@ watch(marketSearch, (newVal) => { + + + + + mdi-alert-circle + {{ tm('conflicts.title') }} + + + + + {{ conflictDialog.count }} + + {{ tm('conflicts.pairs') }} + + + {{ tm('conflicts.message') }} + + + + + {{ tm('buttons.cancel') }} + + {{ tm('conflicts.goToManage') }} + + + + +
+ {{ tm('conflicts.message') }} +