diff --git a/web/app/components/plugins/plugin-detail-panel/index.tsx b/web/app/components/plugins/plugin-detail-panel/index.tsx index 3e746741cc..3378d75b5b 100644 --- a/web/app/components/plugins/plugin-detail-panel/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/index.tsx @@ -59,14 +59,12 @@ const PluginDetailPanel: FC = ({ {!!detail.declaration.agent_strategy && } {!!detail.declaration.endpoint && } {!!detail.declaration.model && } - {false && ( -
- testChange(item)} - /> -
- )} +
+ testChange(item)} + /> +
)} diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx index 18ff2a3707..732c94103f 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx @@ -3,6 +3,7 @@ import type { FC } from 'react' import React, { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { + RiArrowLeftLine, RiArrowRightUpLine, } from '@remixicon/react' import { @@ -39,19 +40,19 @@ import cn from '@/utils/classnames' type Props = { value?: { - provider: string + provider_name: string tool_name: string - description?: string parameters?: Record + extra?: Record } disabled?: boolean placement?: Placement offset?: OffsetOptions onSelect: (tool: { - provider: string + provider_name: string tool_name: string - description?: string parameters?: Record + extra?: Record }) => void supportAddCustomTool?: boolean scope?: string @@ -79,7 +80,7 @@ const ToolSelector: FC = ({ const currentProvider = useMemo(() => { const mergedTools = [...(buildInTools || []), ...(customTools || []), ...(workflowTools || [])] return mergedTools.find((toolWithProvider) => { - return toolWithProvider.id === value?.provider && toolWithProvider.tools.some(tool => tool.name === value?.tool_name) + return toolWithProvider.id === value?.provider_name && toolWithProvider.tools.some(tool => tool.name === value?.tool_name) }) }, [value, buildInTools, customTools, workflowTools]) @@ -87,10 +88,12 @@ const ToolSelector: FC = ({ const handleSelectTool = (tool: ToolDefaultValue) => { const paramValues = addDefaultValue(tool.params, toolParametersToFormSchemas(tool.paramSchemas as any)) const toolValue = { - provider: tool.provider_id, + provider_name: tool.provider_id, tool_name: tool.tool_name, - description: '', parameters: paramValues, + extra: { + description: '', + }, } onSelect(toolValue) setIsShowChooseTool(false) @@ -101,7 +104,10 @@ const ToolSelector: FC = ({ const handleDescriptionChange = (e: React.ChangeEvent) => { onSelect({ ...value, - description: e.target.value || '', + extra: { + ...value?.extra, + description: e.target.value || '', + }, } as any) } @@ -157,75 +163,122 @@ const ToolSelector: FC = ({ /> -
-
{t('plugin.detailPanel.toolSelector.title')}
- {/* base form */} -
-
-
{t('plugin.detailPanel.toolSelector.toolLabel')}
- + {!isShowSettingAuth && ( + <> +
{t('plugin.detailPanel.toolSelector.title')}
+ {/* base form */} +
+
+
{t('plugin.detailPanel.toolSelector.toolLabel')}
+ + } + isShow={isShowChooseTool} + onShowChange={setIsShowChooseTool} + disabled={false} + supportAddCustomTool + onSelect={handleSelectTool} + scope={scope} /> - } - isShow={isShowChooseTool} - onShowChange={setIsShowChooseTool} - disabled={false} - supportAddCustomTool - onSelect={handleSelectTool} - scope={scope} - /> -
-
-
{t('plugin.detailPanel.toolSelector.descriptionLabel')}
-