|
|
|
|
@ -58,7 +58,6 @@ import I18n from '@/context/i18n'
|
|
|
|
|
import { CollectionType } from '@/app/components/tools/types'
|
|
|
|
|
import { CUSTOM_ITERATION_START_NODE } from '@/app/components/workflow/nodes/iteration-start/constants'
|
|
|
|
|
import { useWorkflowConfig } from '@/service/use-workflow'
|
|
|
|
|
import { fetchStrategyList } from '@/service/strategy'
|
|
|
|
|
|
|
|
|
|
export const useIsChatMode = () => {
|
|
|
|
|
const appDetail = useAppStore(s => s.appDetail)
|
|
|
|
|
@ -460,21 +459,6 @@ export const useFetchToolsData = () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const useFetchAgentStrategy = () => {
|
|
|
|
|
const workflowStore = useWorkflowStore()
|
|
|
|
|
const handleFetchAllAgentStrategies = useCallback(async () => {
|
|
|
|
|
const agentStrategies = await fetchStrategyList()
|
|
|
|
|
|
|
|
|
|
workflowStore.setState({
|
|
|
|
|
agentStrategies: agentStrategies || [],
|
|
|
|
|
})
|
|
|
|
|
}, [workflowStore])
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
handleFetchAllAgentStrategies,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const useWorkflowInit = () => {
|
|
|
|
|
const workflowStore = useWorkflowStore()
|
|
|
|
|
const {
|
|
|
|
|
@ -482,7 +466,6 @@ export const useWorkflowInit = () => {
|
|
|
|
|
edges: edgesTemplate,
|
|
|
|
|
} = useWorkflowTemplate()
|
|
|
|
|
const { handleFetchAllTools } = useFetchToolsData()
|
|
|
|
|
const { handleFetchAllAgentStrategies } = useFetchAgentStrategy()
|
|
|
|
|
const appDetail = useAppStore(state => state.appDetail)!
|
|
|
|
|
const setSyncWorkflowDraftHash = useStore(s => s.setSyncWorkflowDraftHash)
|
|
|
|
|
const [data, setData] = useState<FetchWorkflowDraftResponse>()
|
|
|
|
|
@ -562,8 +545,7 @@ export const useWorkflowInit = () => {
|
|
|
|
|
handleFetchAllTools('builtin')
|
|
|
|
|
handleFetchAllTools('custom')
|
|
|
|
|
handleFetchAllTools('workflow')
|
|
|
|
|
handleFetchAllAgentStrategies()
|
|
|
|
|
}, [handleFetchPreloadData, handleFetchAllTools, handleFetchAllAgentStrategies])
|
|
|
|
|
}, [handleFetchPreloadData, handleFetchAllTools])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (data) {
|
|
|
|
|
|