fix: correct validation for agent node which is invoked before publishing the app (#12805)
This commit is contained in:
parent
de4752a16b
commit
b5accda3fe
@ -123,6 +123,7 @@ export const useChecklistBeforePublish = () => {
|
|||||||
const isChatMode = useIsChatMode()
|
const isChatMode = useIsChatMode()
|
||||||
const store = useStoreApi()
|
const store = useStoreApi()
|
||||||
const nodesExtraData = useNodesExtraData()
|
const nodesExtraData = useNodesExtraData()
|
||||||
|
const { data: strategyProviders } = useStrategyProviders()
|
||||||
|
|
||||||
const handleCheckBeforePublish = useCallback(() => {
|
const handleCheckBeforePublish = useCallback(() => {
|
||||||
const {
|
const {
|
||||||
@ -146,6 +147,19 @@ export const useChecklistBeforePublish = () => {
|
|||||||
if (node.data.type === BlockEnum.Tool)
|
if (node.data.type === BlockEnum.Tool)
|
||||||
moreDataForCheckValid = getToolCheckParams(node.data as ToolNodeType, buildInTools, customTools, workflowTools, language)
|
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)
|
const { errorMessage } = nodesExtraData[node.data.type as BlockEnum].checkValid(node.data, t, moreDataForCheckValid)
|
||||||
|
|
||||||
if (errorMessage) {
|
if (errorMessage) {
|
||||||
|
Loading…
Reference in New Issue
Block a user