mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-05-17 13:06:58 +08:00
fix: search model not work as expected (#11225)
This commit is contained in:
parent
594666eb61
commit
3bc4dc58d7
@ -25,22 +25,18 @@ const Popup: FC<PopupProps> = ({
|
|||||||
const language = useLanguage()
|
const language = useLanguage()
|
||||||
const [searchText, setSearchText] = useState('')
|
const [searchText, setSearchText] = useState('')
|
||||||
|
|
||||||
const filteredModelList = modelList.filter(
|
const filteredModelList = modelList.map((model) => {
|
||||||
model => model.models.filter(
|
const filteredModels = model.models.filter((modelItem) => {
|
||||||
(modelItem) => {
|
if (modelItem.label[language] !== undefined)
|
||||||
if (modelItem.label[language] !== undefined)
|
return modelItem.label[language].toLowerCase().includes(searchText.toLowerCase())
|
||||||
return modelItem.label[language].toLowerCase().includes(searchText.toLowerCase())
|
|
||||||
|
|
||||||
let found = false
|
return Object.values(modelItem.label).some(label =>
|
||||||
Object.keys(modelItem.label).forEach((key) => {
|
label.toLowerCase().includes(searchText.toLowerCase()),
|
||||||
if (modelItem.label[key].toLowerCase().includes(searchText.toLowerCase()))
|
)
|
||||||
found = true
|
})
|
||||||
})
|
|
||||||
|
|
||||||
return found
|
return { ...model, models: filteredModels }
|
||||||
},
|
}).filter(model => model.models.length > 0)
|
||||||
).length,
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='w-[320px] max-h-[480px] rounded-lg border-[0.5px] border-gray-200 bg-white shadow-lg overflow-y-auto'>
|
<div className='w-[320px] max-h-[480px] rounded-lg border-[0.5px] border-gray-200 bg-white shadow-lg overflow-y-auto'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user