|
|
|
@ -46,9 +46,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
|
|
|
|
const workflowTools = useStore(s => s.workflowTools)
|
|
|
|
const workflowTools = useStore(s => s.workflowTools)
|
|
|
|
const { data: strategyProviders } = useStrategyProviders()
|
|
|
|
const { data: strategyProviders } = useStrategyProviders()
|
|
|
|
const datasetsDetail = useDatasetsDetailStore(s => s.datasetsDetail)
|
|
|
|
const datasetsDetail = useDatasetsDetailStore(s => s.datasetsDetail)
|
|
|
|
const {
|
|
|
|
const { currentWorkspace } = useAppContext()
|
|
|
|
currentWorkspace,
|
|
|
|
|
|
|
|
} = useAppContext()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const chatVarList = useStore(s => s.conversationVariables)
|
|
|
|
const chatVarList = useStore(s => s.conversationVariables)
|
|
|
|
const environmentVariables = useStore(s => s.environmentVariables)
|
|
|
|
const environmentVariables = useStore(s => s.environmentVariables)
|
|
|
|
@ -182,6 +180,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
|
|
|
|
export const useChecklistBeforePublish = () => {
|
|
|
|
export const useChecklistBeforePublish = () => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const language = useGetLanguage()
|
|
|
|
const language = useGetLanguage()
|
|
|
|
|
|
|
|
const { currentWorkspace } = useAppContext()
|
|
|
|
const buildInTools = useStore(s => s.buildInTools)
|
|
|
|
const buildInTools = useStore(s => s.buildInTools)
|
|
|
|
const customTools = useStore(s => s.customTools)
|
|
|
|
const customTools = useStore(s => s.customTools)
|
|
|
|
const workflowTools = useStore(s => s.workflowTools)
|
|
|
|
const workflowTools = useStore(s => s.workflowTools)
|
|
|
|
@ -234,6 +233,7 @@ export const useChecklistBeforePublish = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const allVariablesMap = transformStartNodeVariables(chatVarList, environmentVariables)
|
|
|
|
const allVariablesMap = transformStartNodeVariables(chatVarList, environmentVariables)
|
|
|
|
|
|
|
|
const workflowVarCheck = currentWorkspace.beta_config?.workflow_var_check
|
|
|
|
|
|
|
|
|
|
|
|
// Before publish, we need to fetch datasets detail, in case of the settings of datasets have been changed
|
|
|
|
// Before publish, we need to fetch datasets detail, in case of the settings of datasets have been changed
|
|
|
|
const knowledgeRetrievalNodes = nodes.filter(node => node.data.type === BlockEnum.KnowledgeRetrieval)
|
|
|
|
const knowledgeRetrievalNodes = nodes.filter(node => node.data.type === BlockEnum.KnowledgeRetrieval)
|
|
|
|
@ -286,7 +286,7 @@ export const useChecklistBeforePublish = () => {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (nodesExtraData[node.data.type as BlockEnum].checkVarValid) {
|
|
|
|
if (workflowVarCheck && nodesExtraData[node.data.type as BlockEnum].checkVarValid) {
|
|
|
|
const { errorMessage: varErrorMessage } = nodesExtraData[node.data.type as BlockEnum].checkVarValid(node.data, { ...allVariablesMap, ...node._parentOutputVarMap }, t)
|
|
|
|
const { errorMessage: varErrorMessage } = nodesExtraData[node.data.type as BlockEnum].checkVarValid(node.data, { ...allVariablesMap, ...node._parentOutputVarMap }, t)
|
|
|
|
if (varErrorMessage?.length) {
|
|
|
|
if (varErrorMessage?.length) {
|
|
|
|
notify({ type: 'error', message: `[${node.data.title}] ${varErrorMessage[0]}` })
|
|
|
|
notify({ type: 'error', message: `[${node.data.title}] ${varErrorMessage[0]}` })
|
|
|
|
|