fix: correct validation for agent node which is invoked before publishing the app (#12805)

This commit is contained in:
kurokobo 2025-01-21 11:07:25 +09:00 committed by GitHub
parent de4752a16b
commit b5accda3fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {