mirror of
https://github.com/langgenius/dify.git
synced 2026-01-05 14:31:05 +00:00
chore: some special to some fns
This commit is contained in:
parent
e290ddc3e5
commit
cab491795a
@ -56,6 +56,10 @@ export const isRagVariableVar = (valueSelector: ValueSelector) => {
|
||||
return valueSelector[0] === 'rag'
|
||||
}
|
||||
|
||||
export const isSpecialVar = (prefix: string): boolean => {
|
||||
return ['sys', 'env', 'conversation', 'rag'].includes(prefix)
|
||||
}
|
||||
|
||||
const inputVarTypeToVarType = (type: InputVarType): VarType => {
|
||||
return ({
|
||||
[InputVarType.number]: VarType.number,
|
||||
@ -527,7 +531,7 @@ const formatItem = (
|
||||
const isCurrentMatched = filterVar(v, (() => {
|
||||
const variableArr = v.variable.split('.')
|
||||
const [first] = variableArr
|
||||
if (first === 'sys' || first === 'env' || first === 'conversation' || first === 'rag')
|
||||
if (isSpecialVar(first))
|
||||
return variableArr
|
||||
|
||||
return [...selector, ...variableArr]
|
||||
|
||||
@ -18,7 +18,7 @@ import { checkKeys } from '@/utils/var'
|
||||
import type { StructuredOutput } from '../../../llm/types'
|
||||
import { Type } from '../../../llm/types'
|
||||
import PickerStructurePanel from '@/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker'
|
||||
import { varTypeToStructType } from './utils'
|
||||
import { isSpecialVar, varTypeToStructType } from './utils'
|
||||
import type { Field } from '@/app/components/workflow/nodes/llm/types'
|
||||
import { FILE_STRUCT } from '@/app/components/workflow/constants'
|
||||
import { Loop } from '@/app/components/base/icons/src/vender/workflow'
|
||||
@ -286,7 +286,7 @@ const VarReferenceVars: FC<Props> = ({
|
||||
}
|
||||
|
||||
const filteredVars = vars.filter((v) => {
|
||||
const children = v.vars.filter(v => checkKeys([v.variable], false).isValid || v.variable.startsWith('sys.') || v.variable.startsWith('env.') || v.variable.startsWith('conversation.') || v.variable.startsWith('rag.'))
|
||||
const children = v.vars.filter(v => checkKeys([v.variable], false).isValid || isSpecialVar(v.variable.split('.')[0]))
|
||||
return children.length > 0
|
||||
}).filter((node) => {
|
||||
if (!searchText)
|
||||
@ -297,7 +297,7 @@ const VarReferenceVars: FC<Props> = ({
|
||||
})
|
||||
return children.length > 0
|
||||
}).map((node) => {
|
||||
let vars = node.vars.filter(v => checkKeys([v.variable], false).isValid || v.variable.startsWith('sys.') || v.variable.startsWith('env.') || v.variable.startsWith('conversation.') || v.variable.startsWith('rag.'))
|
||||
let vars = node.vars.filter(v => checkKeys([v.variable], false).isValid || isSpecialVar(v.variable.split('.')[0]))
|
||||
if (searchText) {
|
||||
const searchTextLower = searchText.toLowerCase()
|
||||
if (!node.title.toLowerCase().includes(searchTextLower))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user