Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: search model not work as expected (#11225)

非法操作3bc4dc58d70a
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx
index 1a910aba08e..1e43439d157 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx
@@ -25,22 +25,18 @@ const Popup: FC<PopupProps> = ({
const language = useLanguage()
const [searchText, setSearchText] = useState('')
- const filteredModelList = modelList.filter(
- model => model.models.filter(
- (modelItem) => {
- if (modelItem.label[language] !== undefined)
- return modelItem.label[language].toLowerCase().includes(searchText.toLowerCase())
+ const filteredModelList = modelList.map((model) => {
+ const filteredModels = model.models.filter((modelItem) => {
+ if (modelItem.label[language] !== undefined)
+ return modelItem.label[language].toLowerCase().includes(searchText.toLowerCase())
- let found = false
- Object.keys(modelItem.label).forEach((key) => {
- if (modelItem.label[key].toLowerCase().includes(searchText.toLowerCase()))
- found = true
- })
+ return Object.values(modelItem.label).some(label =>
+ label.toLowerCase().includes(searchText.toLowerCase()),
+ )
+ })
- return found
- },
- ).length,
- )
+ return { ...model, models: filteredModels }
+ }).filter(model => model.models.length > 0)
return (
<div className='w-[320px] max-h-[480px] rounded-lg border-[0.5px] border-gray-200 bg-white shadow-lg overflow-y-auto'>