diff --git a/web/app/components/workflow/nodes/agent/node.tsx b/web/app/components/workflow/nodes/agent/node.tsx index 15580f625e..2cf9c67233 100644 --- a/web/app/components/workflow/nodes/agent/node.tsx +++ b/web/app/components/workflow/nodes/agent/node.tsx @@ -10,6 +10,7 @@ import useConfig from './use-config' import { useTranslation } from 'react-i18next' import { FormTypeEnum, ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useModelList } from '@/app/components/header/account-setting/model-provider-page/hooks' +import { useRenderI18nObject } from '@/hooks/use-i18n' const useAllModel = () => { const { data: textGeneration } = useModelList(ModelTypeEnum.textGeneration) @@ -32,7 +33,8 @@ const useAllModel = () => { } const AgentNode: FC> = (props) => { - const { inputs, currentStrategy } = useConfig(props.id, props.data) + const { inputs, currentStrategy, currentStrategyStatus, pluginDetail } = useConfig(props.id, props.data) + const renderI18nObject = useRenderI18nObject() const { t } = useTranslation() const modelList = useAllModel() const models = useMemo(() => { @@ -87,9 +89,16 @@ const AgentNode: FC> = (props) => { {inputs.agent_strategy_name ? {inputs.agent_strategy_label} diff --git a/web/app/components/workflow/nodes/agent/use-config.ts b/web/app/components/workflow/nodes/agent/use-config.ts index a1f96e33a2..e880b90e1c 100644 --- a/web/app/components/workflow/nodes/agent/use-config.ts +++ b/web/app/components/workflow/nodes/agent/use-config.ts @@ -8,6 +8,7 @@ import { } from '@/app/components/workflow/hooks' import { useMemo } from 'react' import { type ToolVarInputs, VarType } from '../tool/types' +import { useCheckInstalled } from '@/service/use-plugins' const useConfig = (id: string, payload: AgentNodeType) => { const { nodesReadOnly: readOnly } = useNodesReadOnly() @@ -20,16 +21,20 @@ const useConfig = (id: string, payload: AgentNodeType) => { const strategyProvider = useStrategyProviderDetail( inputs.agent_strategy_provider_name || '', ) - const currentStrategy = strategyProvider.data?.declaration.strategies.find( str => str.identity.name === inputs.agent_strategy_name, ) - const currentStrategyStatus = useMemo(() => { + const currentStrategyStatus: 'loading' | 'plugin-not-found' | 'strategy-not-found' | 'success' = useMemo(() => { if (strategyProvider.isLoading) return 'loading' if (strategyProvider.isError) return 'plugin-not-found' if (!currentStrategy) return 'strategy-not-found' return 'success' }, [currentStrategy, strategyProvider]) + const pluginId = inputs.agent_strategy_provider_name?.split('/').splice(0, 2).join('/') + const pluginDetail = useCheckInstalled({ + pluginIds: [pluginId || ''], + enabled: Boolean(pluginId), + }) const formData = useMemo(() => { return Object.fromEntries( Object.entries(inputs.agent_parameters || {}).map(([key, value]) => { @@ -91,6 +96,7 @@ const useConfig = (id: string, payload: AgentNodeType) => { onFormChange, currentStrategyStatus, strategyProvider: strategyProvider.data, + pluginDetail: pluginDetail.data?.plugins.at(0), isShowSingleRun, showSingleRun, diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index 583d30f2c1..4b8d2e1452 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -732,6 +732,7 @@ const translation = { toolNotInstallTooltip: '{{tool}} is not installed', toolNotAuthorizedTooltip: '{{tool}} Not Authorized', strategyNotInstallTooltip: '{{strategy}} is not installed', + strategyNotFoundInPlugin: '{{strategy}} is not found in {{plugin}}', modelSelectorTooltips: { deprecated: 'This model is deprecated', }, diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 57b53d0644..635d9cf3ce 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -732,6 +732,7 @@ const translation = { toolNotInstallTooltip: '{{tool}} 未安装', toolNotAuthorizedTooltip: '{{tool}} 未授权', strategyNotInstallTooltip: '{{strategy}} 未安装', + strategyNotFoundInPlugin: '在 {{plugin}} 中未找到 {{strategy}}', modelSelectorTooltips: { deprecated: '此模型已弃用', },