mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-18 05:25:54 +08:00
chore: prompt not support file var
This commit is contained in:
parent
7218f718ad
commit
2740d68cd1
@ -23,7 +23,9 @@ const VarReferencePopup: FC<Props> = ({
|
|||||||
searchBoxClassName='mt-1'
|
searchBoxClassName='mt-1'
|
||||||
vars={vars}
|
vars={vars}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
itemWidth={itemWidth} />
|
itemWidth={itemWidth}
|
||||||
|
isSupportFileVar
|
||||||
|
/>
|
||||||
</div >
|
</div >
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ type ObjectChildrenProps = {
|
|||||||
onChange: (value: ValueSelector, item: Var) => void
|
onChange: (value: ValueSelector, item: Var) => void
|
||||||
onHovering?: (value: boolean) => void
|
onHovering?: (value: boolean) => void
|
||||||
itemWidth?: number
|
itemWidth?: number
|
||||||
|
isSupportFileVar?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type ItemProps = {
|
type ItemProps = {
|
||||||
@ -35,6 +36,7 @@ type ItemProps = {
|
|||||||
onChange: (value: ValueSelector, item: Var) => void
|
onChange: (value: ValueSelector, item: Var) => void
|
||||||
onHovering?: (value: boolean) => void
|
onHovering?: (value: boolean) => void
|
||||||
itemWidth?: number
|
itemWidth?: number
|
||||||
|
isSupportFileVar?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const Item: FC<ItemProps> = ({
|
const Item: FC<ItemProps> = ({
|
||||||
@ -45,6 +47,7 @@ const Item: FC<ItemProps> = ({
|
|||||||
onChange,
|
onChange,
|
||||||
onHovering,
|
onHovering,
|
||||||
itemWidth,
|
itemWidth,
|
||||||
|
isSupportFileVar,
|
||||||
}) => {
|
}) => {
|
||||||
const isFile = itemData.type === VarType.file
|
const isFile = itemData.type === VarType.file
|
||||||
const isObj = ([VarType.object, VarType.file].includes(itemData.type) && itemData.children && itemData.children.length > 0)
|
const isObj = ([VarType.object, VarType.file].includes(itemData.type) && itemData.children && itemData.children.length > 0)
|
||||||
@ -79,6 +82,9 @@ const Item: FC<ItemProps> = ({
|
|||||||
}, [isHovering])
|
}, [isHovering])
|
||||||
const handleChosen = (e: React.MouseEvent) => {
|
const handleChosen = (e: React.MouseEvent) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
if (!isSupportFileVar && isFile)
|
||||||
|
return
|
||||||
|
|
||||||
if (isSys || isEnv || isChatVar) { // system variable | environment variable | conversation variable
|
if (isSys || isEnv || isChatVar) { // system variable | environment variable | conversation variable
|
||||||
onChange([...objPath, ...itemData.variable.split('.')], itemData)
|
onChange([...objPath, ...itemData.variable.split('.')], itemData)
|
||||||
}
|
}
|
||||||
@ -135,6 +141,7 @@ const Item: FC<ItemProps> = ({
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onHovering={setIsChildrenHovering}
|
onHovering={setIsChildrenHovering}
|
||||||
itemWidth={itemWidth}
|
itemWidth={itemWidth}
|
||||||
|
isSupportFileVar={isSupportFileVar}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isFile && (
|
{isFile && (
|
||||||
@ -147,6 +154,7 @@ const Item: FC<ItemProps> = ({
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onHovering={setIsChildrenHovering}
|
onHovering={setIsChildrenHovering}
|
||||||
itemWidth={itemWidth}
|
itemWidth={itemWidth}
|
||||||
|
isSupportFileVar={isSupportFileVar}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</PortalToFollowElemContent>
|
</PortalToFollowElemContent>
|
||||||
@ -162,6 +170,7 @@ const ObjectChildren: FC<ObjectChildrenProps> = ({
|
|||||||
onChange,
|
onChange,
|
||||||
onHovering,
|
onHovering,
|
||||||
itemWidth,
|
itemWidth,
|
||||||
|
isSupportFileVar,
|
||||||
}) => {
|
}) => {
|
||||||
const currObjPath = objPath
|
const currObjPath = objPath
|
||||||
const itemRef = useRef(null)
|
const itemRef = useRef(null)
|
||||||
@ -206,6 +215,7 @@ const ObjectChildren: FC<ObjectChildrenProps> = ({
|
|||||||
itemData={v}
|
itemData={v}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onHovering={setIsChildrenHovering}
|
onHovering={setIsChildrenHovering}
|
||||||
|
isSupportFileVar={isSupportFileVar}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@ -217,6 +227,7 @@ type Props = {
|
|||||||
hideSearch?: boolean
|
hideSearch?: boolean
|
||||||
searchBoxClassName?: string
|
searchBoxClassName?: string
|
||||||
vars: NodeOutPutVar[]
|
vars: NodeOutPutVar[]
|
||||||
|
isSupportFileVar?: boolean
|
||||||
onChange: (value: ValueSelector, item: Var) => void
|
onChange: (value: ValueSelector, item: Var) => void
|
||||||
itemWidth?: number
|
itemWidth?: number
|
||||||
maxHeightClass?: string
|
maxHeightClass?: string
|
||||||
@ -225,6 +236,7 @@ const VarReferenceVars: FC<Props> = ({
|
|||||||
hideSearch,
|
hideSearch,
|
||||||
searchBoxClassName,
|
searchBoxClassName,
|
||||||
vars,
|
vars,
|
||||||
|
isSupportFileVar,
|
||||||
onChange,
|
onChange,
|
||||||
itemWidth,
|
itemWidth,
|
||||||
maxHeightClass,
|
maxHeightClass,
|
||||||
@ -299,6 +311,7 @@ const VarReferenceVars: FC<Props> = ({
|
|||||||
itemData={v}
|
itemData={v}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
itemWidth={itemWidth}
|
itemWidth={itemWidth}
|
||||||
|
isSupportFileVar={isSupportFileVar}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>))
|
</div>))
|
||||||
|
@ -64,6 +64,7 @@ const ConditionAdd = ({
|
|||||||
<div className='w-[296px] bg-components-panel-bg-blur rounded-lg border-[0.5px] border-components-panel-border shadow-lg'>
|
<div className='w-[296px] bg-components-panel-bg-blur rounded-lg border-[0.5px] border-components-panel-border shadow-lg'>
|
||||||
<VarReferenceVars
|
<VarReferenceVars
|
||||||
vars={variables}
|
vars={variables}
|
||||||
|
isSupportFileVar
|
||||||
onChange={handleSelectVariable}
|
onChange={handleSelectVariable}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user