mirror of https://github.com/langgenius/dify.git
fix: global var show in node
This commit is contained in:
parent
7510e0654b
commit
6ba26cf7b5
|
|
@ -11,6 +11,7 @@ import VariableIcon from './variable-icon'
|
|||
import VariableName from './variable-name'
|
||||
import cn from '@/utils/classnames'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import { isConversationVar, isENV, isGlobalVar, isRagVariableVar } from '../../utils'
|
||||
|
||||
const VariableLabel = ({
|
||||
nodeType,
|
||||
|
|
@ -26,6 +27,7 @@ const VariableLabel = ({
|
|||
rightSlot,
|
||||
}: VariablePayload) => {
|
||||
const varColorClassName = useVarColor(variables, isExceptionVariable)
|
||||
const isHideNodeLabel = !(isENV(variables) || isConversationVar(variables) || isGlobalVar(variables) || isRagVariableVar(variables))
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
|
|
@ -35,10 +37,12 @@ const VariableLabel = ({
|
|||
onClick={onClick}
|
||||
ref={ref}
|
||||
>
|
||||
<VariableNodeLabel
|
||||
nodeType={nodeType}
|
||||
nodeTitle={nodeTitle}
|
||||
/>
|
||||
{ isHideNodeLabel && (
|
||||
<VariableNodeLabel
|
||||
nodeType={nodeType}
|
||||
nodeTitle={nodeTitle}
|
||||
/>
|
||||
)}
|
||||
{
|
||||
notShowFullPath && (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
isSystemVar,
|
||||
} from '../utils'
|
||||
import { VarInInspectType } from '@/types/workflow'
|
||||
import { VAR_SHOW_NAME_MAP } from '@/app/components/workflow/constants'
|
||||
|
||||
export const useVarIcon = (variables: string[], variableCategory?: VarInInspectType | string) => {
|
||||
if (variableCategory === 'loop')
|
||||
|
|
@ -53,6 +54,7 @@ export const useVarColor = (variables: string[], isExceptionVariable?: boolean,
|
|||
}
|
||||
|
||||
export const useVarName = (variables: string[], notShowFullPath?: boolean) => {
|
||||
const showName = VAR_SHOW_NAME_MAP[variables.join('.')]
|
||||
let variableFullPathName = variables.slice(1).join('.')
|
||||
|
||||
if (isRagVariableVar(variables))
|
||||
|
|
@ -65,6 +67,8 @@ export const useVarName = (variables: string[], notShowFullPath?: boolean) => {
|
|||
return `${isSystem ? 'sys.' : ''}${varName}`
|
||||
}, [variables, notShowFullPath])
|
||||
|
||||
if(showName)
|
||||
return showName
|
||||
return varName
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue