fix: switch version not work

This commit is contained in:
AkaraChen 2025-01-09 16:08:20 +08:00
parent efb6a5dd3e
commit 145ef794b6
2 changed files with 8 additions and 3 deletions

View File

@ -99,7 +99,7 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) =>
if (!list) return []
return list.filter(tool => tool.name.toLowerCase().includes(query.toLowerCase()))
}, [query, list])
const { strategyStatus } = useStrategyInfo(
const { strategyStatus, refetch: refetchStrategyInfo } = useStrategyInfo(
value?.agent_strategy_provider_name,
value?.agent_strategy_name,
)
@ -178,13 +178,13 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) =>
: <RiArrowDownSLine className='size-4 text-text-tertiary' />
}
{showSwitchVersion && <SwitchPluginVersion
uniqueIdentifier={'langgenius/openai:12'}
uniqueIdentifier={value.plugin_unique_identifier}
tooltip={<ToolTipContent
title={t('workflow.nodes.agent.unsupportedStrategy')}>
{t('workflow.nodes.agent.strategyNotFoundDescAndSwitchVersion')}
</ToolTipContent>}
onChange={() => {
// TODO: refresh all strategies
refetchStrategyInfo()
}}
/>}
</div>

View File

@ -49,10 +49,15 @@ export const useStrategyInfo = (
isExistInPlugin: strategyExist,
}
}, [strategy, marketplace, strategyProvider.isError, strategyProvider.isLoading])
const refetch = useCallback(() => {
strategyProvider.refetch()
marketplace.refetch()
}, [marketplace, strategyProvider])
return {
strategyProvider,
strategy,
strategyStatus,
refetch,
}
}