From b5accda3fe03a492f700073325846840922c6089 Mon Sep 17 00:00:00 2001 From: kurokobo Date: Tue, 21 Jan 2025 11:07:25 +0900 Subject: [PATCH] fix: correct validation for agent node which is invoked before publishing the app (#12805) --- web/app/components/workflow/hooks/use-checklist.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/app/components/workflow/hooks/use-checklist.ts b/web/app/components/workflow/hooks/use-checklist.ts index b7e717de2b..561c70fc30 100644 --- a/web/app/components/workflow/hooks/use-checklist.ts +++ b/web/app/components/workflow/hooks/use-checklist.ts @@ -123,6 +123,7 @@ export const useChecklistBeforePublish = () => { const isChatMode = useIsChatMode() const store = useStoreApi() const nodesExtraData = useNodesExtraData() + const { data: strategyProviders } = useStrategyProviders() const handleCheckBeforePublish = useCallback(() => { const { @@ -146,6 +147,19 @@ export const useChecklistBeforePublish = () => { if (node.data.type === BlockEnum.Tool) moreDataForCheckValid = getToolCheckParams(node.data as ToolNodeType, buildInTools, customTools, workflowTools, language) + if (node.data.type === BlockEnum.Agent) { + const data = node.data as AgentNodeType + const isReadyForCheckValid = !!strategyProviders + const provider = strategyProviders?.find(provider => provider.declaration.identity.name === data.agent_strategy_provider_name) + const strategy = provider?.declaration.strategies?.find(s => s.identity.name === data.agent_strategy_name) + moreDataForCheckValid = { + provider, + strategy, + language, + isReadyForCheckValid, + } + } + const { errorMessage } = nodesExtraData[node.data.type as BlockEnum].checkValid(node.data, t, moreDataForCheckValid) if (errorMessage) {