fix: checklist show error when strategy provider list not fetched
This commit is contained in:
parent
4e29694a46
commit
b450c6f976
@ -62,12 +62,14 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
|
|||||||
|
|
||||||
if (node.data.type === BlockEnum.Agent) {
|
if (node.data.type === BlockEnum.Agent) {
|
||||||
const data = node.data as AgentNodeType
|
const data = node.data as AgentNodeType
|
||||||
|
const isReadyForCheckValid = !!strategyProviders
|
||||||
const provider = strategyProviders?.find(provider => provider.declaration.identity.name === data.agent_strategy_provider_name)
|
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)
|
const strategy = provider?.declaration.strategies?.find(s => s.identity.name === data.agent_strategy_name)
|
||||||
moreDataForCheckValid = {
|
moreDataForCheckValid = {
|
||||||
provider,
|
provider,
|
||||||
strategy,
|
strategy,
|
||||||
language,
|
language,
|
||||||
|
isReadyForCheckValid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,15 @@ const nodeDefault: NodeDefault<AgentNodeType> = {
|
|||||||
strategyProvider?: StrategyPluginDetail,
|
strategyProvider?: StrategyPluginDetail,
|
||||||
strategy?: StrategyDetail
|
strategy?: StrategyDetail
|
||||||
language: string
|
language: string
|
||||||
|
isReadyForCheckValid: boolean
|
||||||
}) {
|
}) {
|
||||||
const { strategy, language } = moreDataForCheckValid
|
const { strategy, language, isReadyForCheckValid } = moreDataForCheckValid
|
||||||
|
if (!isReadyForCheckValid) {
|
||||||
|
return {
|
||||||
|
isValid: true,
|
||||||
|
errorMessage: '',
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!strategy) {
|
if (!strategy) {
|
||||||
return {
|
return {
|
||||||
isValid: false,
|
isValid: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user