Skip to content

Commit b5accda

Browse files
authored
fix: correct validation for agent node which is invoked before publishing the app (#12805)
1 parent de4752a commit b5accda

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

web/app/components/workflow/hooks/use-checklist.ts

+14
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export const useChecklistBeforePublish = () => {
123123
const isChatMode = useIsChatMode()
124124
const store = useStoreApi()
125125
const nodesExtraData = useNodesExtraData()
126+
const { data: strategyProviders } = useStrategyProviders()
126127

127128
const handleCheckBeforePublish = useCallback(() => {
128129
const {
@@ -146,6 +147,19 @@ export const useChecklistBeforePublish = () => {
146147
if (node.data.type === BlockEnum.Tool)
147148
moreDataForCheckValid = getToolCheckParams(node.data as ToolNodeType, buildInTools, customTools, workflowTools, language)
148149

150+
if (node.data.type === BlockEnum.Agent) {
151+
const data = node.data as AgentNodeType
152+
const isReadyForCheckValid = !!strategyProviders
153+
const provider = strategyProviders?.find(provider => provider.declaration.identity.name === data.agent_strategy_provider_name)
154+
const strategy = provider?.declaration.strategies?.find(s => s.identity.name === data.agent_strategy_name)
155+
moreDataForCheckValid = {
156+
provider,
157+
strategy,
158+
language,
159+
isReadyForCheckValid,
160+
}
161+
}
162+
149163
const { errorMessage } = nodesExtraData[node.data.type as BlockEnum].checkValid(node.data, t, moreDataForCheckValid)
150164

151165
if (errorMessage) {

0 commit comments

Comments
 (0)