diff --git a/astrbot/dashboard/routes/tools.py b/astrbot/dashboard/routes/tools.py index 64cd78caa..d7b082000 100644 --- a/astrbot/dashboard/routes/tools.py +++ b/astrbot/dashboard/routes/tools.py @@ -3,6 +3,7 @@ import traceback from quart import request from astrbot.core import logger +from astrbot.core.agent.mcp_client import MCPTool from astrbot.core.core_lifecycle import AstrBotCoreLifecycle from astrbot.core.star import star_map @@ -296,15 +297,30 @@ class ToolsRoute(Route): """获取所有注册的工具列表""" try: tools = self.tool_mgr.func_list - tools_dict = [ - { + tools_dict = [] + for tool in tools: + if isinstance(tool, MCPTool): + origin = "mcp" + origin_name = tool.mcp_server_name + elif tool.handler_module_path and star_map.get( + tool.handler_module_path + ): + star = star_map[tool.handler_module_path] + origin = "plugin" + origin_name = star.name + else: + origin = "unknown" + origin_name = "unknown" + + tool_info = { "name": tool.name, "description": tool.description, "parameters": tool.parameters, "active": tool.active, + "origin": origin, + "origin_name": origin_name, } - for tool in tools - ] + tools_dict.append(tool_info) return Response().ok(data=tools_dict).__dict__ except Exception as e: logger.error(traceback.format_exc()) diff --git a/dashboard/src/views/ToolUsePage.vue b/dashboard/src/components/extension/McpServersSection.vue similarity index 62% rename from dashboard/src/views/ToolUsePage.vue rename to dashboard/src/components/extension/McpServersSection.vue index db8fee905..fe20497f8 100644 --- a/dashboard/src/views/ToolUsePage.vue +++ b/dashboard/src/components/extension/McpServersSection.vue @@ -4,42 +4,18 @@
-

- mdi-function-variant{{ tm('title') }} -

-

- {{ tm('subtitle') }} - - - {{ tm('tooltip.info') }} - -

-
-
- - {{ tm('functionTools.buttons.view') }}({{ tools.length }}) - + @click="showMcpServerDialog = true" > {{ tm('mcpServers.buttons.add') }} + > {{ tm('mcpServers.buttons.sync') }}
- - -
mdi-server-off

{{ tm('mcpServers.empty') }}

@@ -57,7 +33,6 @@
-
@@ -67,8 +42,7 @@ - -
@@ -105,8 +74,6 @@
- - @@ -183,8 +150,7 @@ - - + @@ -240,115 +206,8 @@ - - - - - {{ tm('functionTools.title') }} - {{ tools.length }} - - - -
-
- mdi-api-off -

{{ tm('functionTools.empty') }}

-
- -
- - - 复选框代表该工具是否被启用。 - - - - - - - - - -
- - {{ tool.name.includes(':') ? 'mdi-server-network' : 'mdi-function-variant' }} - - - {{ formatToolName(tool.name) }} - -
-
- - {{ tool.description }} - -
-
- - - - -

- mdi-information - {{ tm('functionTools.description') }} -

-

{{ tool.description }}

- - -
- mdi-code-brackets -

{{ tm('functionTools.noParameters') }}

-
-
-
-
-
-
-
-
-
-
- - - - - {{ tm('dialogs.serverDetail.buttons.close') }} - - -
-
- - + {{ save_message }} @@ -356,15 +215,13 @@ \ No newline at end of file + diff --git a/dashboard/src/views/commandPanel/components/CommandFilters.vue b/dashboard/src/components/extension/componentPanel/components/CommandFilters.vue similarity index 100% rename from dashboard/src/views/commandPanel/components/CommandFilters.vue rename to dashboard/src/components/extension/componentPanel/components/CommandFilters.vue diff --git a/dashboard/src/views/commandPanel/components/CommandTable.vue b/dashboard/src/components/extension/componentPanel/components/CommandTable.vue similarity index 99% rename from dashboard/src/views/commandPanel/components/CommandTable.vue rename to dashboard/src/components/extension/componentPanel/components/CommandTable.vue index 44a879c8b..f8bb6fa82 100644 --- a/dashboard/src/views/commandPanel/components/CommandTable.vue +++ b/dashboard/src/components/extension/componentPanel/components/CommandTable.vue @@ -9,6 +9,7 @@ const { tm } = useModuleI18n('features/command'); const props = defineProps<{ items: CommandItem[]; expandedGroups: Set; + loading?: boolean; }>(); // Emits @@ -98,6 +99,7 @@ const getRowProps = ({ item }: { item: CommandItem }) => { item-key="handler_full_name" hover :row-props="getRowProps" + :loading="props.loading" >