mirror of
https://github.com/langgenius/dify.git
synced 2026-04-13 14:48:11 +08:00
fix(workflow): improve formatting and add checkbox type to input variable type mapping
This commit is contained in:
parent
343f1a375f
commit
5e854238b0
@ -350,7 +350,7 @@ const VarReferencePicker: FC<Props> = ({
|
||||
const data = await fetchDynamicOptions()
|
||||
setDynamicOptions(data?.options || [])
|
||||
}
|
||||
finally {
|
||||
finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,9 +25,9 @@ const useAvailableVarList = (nodeId: string, {
|
||||
hideChatVar,
|
||||
passedInAvailableNodes,
|
||||
}: Params = {
|
||||
onlyLeafNodeVar: false,
|
||||
filterVar: () => true,
|
||||
}) => {
|
||||
onlyLeafNodeVar: false,
|
||||
filterVar: () => true,
|
||||
}) => {
|
||||
const { getTreeLeafNodes, getNodeById, getBeforeNodesInSameBranchIncludeParent } = useWorkflow()
|
||||
const { getNodeAvailableVars } = useWorkflowVariables()
|
||||
const isChatMode = useIsChatMode()
|
||||
@ -40,7 +40,7 @@ const useAvailableVarList = (nodeId: string, {
|
||||
const ragPipelineVariables = useWorkflowStore(s => s.ragPipelineVariables)
|
||||
const isDataSourceNode = currNode?.data?.type === BlockEnum.DataSource
|
||||
const dataSourceRagVars: NodeOutPutVar[] = []
|
||||
if(isDataSourceNode) {
|
||||
if (isDataSourceNode) {
|
||||
const ragVariablesInDataSource = ragPipelineVariables?.filter(ragVariable => ragVariable.belong_to_node_id === nodeId)
|
||||
const filterVars = ragVariablesInDataSource?.filter(v => filterVar({
|
||||
variable: v.variable,
|
||||
@ -48,18 +48,18 @@ const useAvailableVarList = (nodeId: string, {
|
||||
nodeId,
|
||||
isRagVariable: true,
|
||||
}, ['rag', nodeId, v.variable]))
|
||||
if(filterVars?.length) {
|
||||
if (filterVars?.length) {
|
||||
dataSourceRagVars.push({
|
||||
nodeId,
|
||||
title: currNode.data?.title,
|
||||
vars: filterVars.map((v) => {
|
||||
return {
|
||||
variable: `rag.${nodeId}.${v.variable}`,
|
||||
type: inputVarTypeToVarType(v.type),
|
||||
description: v.label,
|
||||
isRagVariable: true,
|
||||
nodeId,
|
||||
title: currNode.data?.title,
|
||||
vars: filterVars.map((v) => {
|
||||
return {
|
||||
variable: `rag.${nodeId}.${v.variable}`,
|
||||
type: inputVarTypeToVarType(v.type),
|
||||
description: v.label,
|
||||
isRagVariable: true,
|
||||
} as Var
|
||||
}),
|
||||
}),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,5 +6,6 @@ export const inputVarTypeToVarType = (type: PipelineInputVarType): VarType => {
|
||||
[PipelineInputVarType.number]: VarType.number,
|
||||
[PipelineInputVarType.singleFile]: VarType.file,
|
||||
[PipelineInputVarType.multiFiles]: VarType.arrayFile,
|
||||
[PipelineInputVarType.checkbox]: VarType.boolean,
|
||||
} as any)[type] || VarType.string
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user