mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-01 18:57:51 +08:00
chore: improve reference variable picker user experience (#3517)
This commit is contained in:
parent
b9fbc39754
commit
f89c4203a0
@ -208,18 +208,24 @@ const VarReferenceVars: FC<Props> = ({
|
||||
const filteredVars = vars.filter((v) => {
|
||||
const children = v.vars.filter(v => checkKeys([v.variable], false).isValid || v.variable.startsWith('sys.'))
|
||||
return children.length > 0
|
||||
}).filter((v) => {
|
||||
}).filter((node) => {
|
||||
if (!searchText)
|
||||
return v
|
||||
const children = v.vars.filter(v => v.variable.toLowerCase().includes(searchText.toLowerCase()))
|
||||
return node
|
||||
const children = node.vars.filter((v) => {
|
||||
const searchTextLower = searchText.toLowerCase()
|
||||
return v.variable.toLowerCase().includes(searchTextLower) || node.title.toLowerCase().includes(searchTextLower)
|
||||
})
|
||||
return children.length > 0
|
||||
}).map((v) => {
|
||||
let vars = v.vars.filter(v => checkKeys([v.variable], false).isValid || v.variable.startsWith('sys.'))
|
||||
if (searchText)
|
||||
vars = vars.filter(v => v.variable.toLowerCase().includes(searchText.toLowerCase()))
|
||||
}).map((node) => {
|
||||
let vars = node.vars.filter(v => checkKeys([v.variable], false).isValid || v.variable.startsWith('sys.'))
|
||||
if (searchText) {
|
||||
const searchTextLower = searchText.toLowerCase()
|
||||
if (!node.title.toLowerCase().includes(searchTextLower))
|
||||
vars = vars.filter(v => v.variable.toLowerCase().includes(searchText.toLowerCase()))
|
||||
}
|
||||
|
||||
return {
|
||||
...v,
|
||||
...node,
|
||||
vars,
|
||||
}
|
||||
})
|
||||
@ -266,7 +272,7 @@ const VarReferenceVars: FC<Props> = ({
|
||||
}
|
||||
|
||||
{filteredVars.length > 0
|
||||
? <div>
|
||||
? <div className='max-h-[85vh] overflow-y-auto'>
|
||||
|
||||
{
|
||||
filteredVars.map((item, i) => (
|
||||
|
Loading…
Reference in New Issue
Block a user