From 2511968cb4a9284935cbee078cd52b12d62c9e45 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Wed, 6 Nov 2024 17:19:51 +0800 Subject: [PATCH] fix action list --- .../plugins/plugin-detail-panel/action-list.tsx | 11 ++++++++--- .../plugins/plugin-detail-panel/detail-header.tsx | 6 ++++-- .../plugins/plugin-detail-panel/endpoint-list.tsx | 2 +- web/app/components/plugins/types.ts | 2 +- web/app/components/tools/provider/tool-item.tsx | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/web/app/components/plugins/plugin-detail-panel/action-list.tsx b/web/app/components/plugins/plugin-detail-panel/action-list.tsx index 96ca303d16..13027803d2 100644 --- a/web/app/components/plugins/plugin-detail-panel/action-list.tsx +++ b/web/app/components/plugins/plugin-detail-panel/action-list.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React, { useMemo, useState } from 'react' import useSWR from 'swr' import { useTranslation } from 'react-i18next' import { usePluginPageContext } from '@/app/components/plugins/plugin-page/context' @@ -18,9 +18,14 @@ const ActionList = () => { const { t } = useTranslation() const { isCurrentWorkspaceManager } = useAppContext() const currentPluginDetail = usePluginPageContext(v => v.currentPluginDetail) - const providerDeclaration = currentPluginDetail.declaration.tool.identity + const providerDeclaration = useMemo(() => { + return { + ...currentPluginDetail.declaration.tool.identity, + name: `${currentPluginDetail.plugin_id}/${currentPluginDetail.name}`, + } + }, [currentPluginDetail.declaration.tool.identity, currentPluginDetail.name, currentPluginDetail.plugin_id]) const { data } = useSWR( - `/workspaces/current/tool-provider/builtin/${currentPluginDetail.plugin_id}/${currentPluginDetail.name}/tools`, + `${currentPluginDetail.plugin_id}/${currentPluginDetail.name}`, fetchBuiltInToolList, ) diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header.tsx index 2f8ec889f4..ad9760feff 100644 --- a/web/app/components/plugins/plugin-detail-panel/detail-header.tsx +++ b/web/app/components/plugins/plugin-detail-panel/detail-header.tsx @@ -92,7 +92,9 @@ const DetailHeader = ({ return (
- +
+ +
@@ -154,7 +156,7 @@ const DetailHeader = ({ <PluginInfo repository={isFromGitHub ? meta?.repo : ''} release={version} - packageName={meta?.package} + packageName={meta?.package || ''} onHide={hidePluginInfo} /> )} diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx index a610d3dc25..495d451f90 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx @@ -25,7 +25,7 @@ const EndpointList = () => { params: { plugin_id: pluginDetail.plugin_id, page: 1, - limit: 100, + page_size: 100, }, }, fetchEndpointList, diff --git a/web/app/components/plugins/types.ts b/web/app/components/plugins/types.ts index 304ebcab69..95b255de62 100644 --- a/web/app/components/plugins/types.ts +++ b/web/app/components/plugins/types.ts @@ -203,7 +203,7 @@ export type EndpointOperationResponse = { result: 'success' | 'error' } export type EndpointsRequest = { - limit: number + page_size: number page: number plugin_id: string } diff --git a/web/app/components/tools/provider/tool-item.tsx b/web/app/components/tools/provider/tool-item.tsx index 897b549c38..89bb779f6a 100644 --- a/web/app/components/tools/provider/tool-item.tsx +++ b/web/app/components/tools/provider/tool-item.tsx @@ -7,7 +7,7 @@ import I18n from '@/context/i18n' import { getLanguage } from '@/i18n/language' import SettingBuiltInTool from '@/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool' -interface Props { +type Props = { disabled?: boolean collection: Collection tool: Tool