fix: checklist show error when strategy provider list not fetched

This commit is contained in:
AkaraChen 2025-01-09 17:41:08 +08:00
parent 4e29694a46
commit b450c6f976
2 changed files with 10 additions and 1 deletions

View File

@ -62,12 +62,14 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
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,
}
}

View File

@ -21,8 +21,15 @@ const nodeDefault: NodeDefault<AgentNodeType> = {
strategyProvider?: StrategyPluginDetail,
strategy?: StrategyDetail
language: string
isReadyForCheckValid: boolean
}) {
const { strategy, language } = moreDataForCheckValid
const { strategy, language, isReadyForCheckValid } = moreDataForCheckValid
if (!isReadyForCheckValid) {
return {
isValid: true,
errorMessage: '',
}
}
if (!strategy) {
return {
isValid: false,