mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-17 14:55:23 +00:00
refac: dedup tags
This commit is contained in:
parent
cde4b93fa6
commit
314cac0113
1 changed files with 8 additions and 3 deletions
|
|
@ -121,7 +121,10 @@
|
||||||
if (selectedTag === '') {
|
if (selectedTag === '') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return (item.model?.tags ?? []).map((tag) => tag.name).includes(selectedTag);
|
|
||||||
|
return (item.model?.tags ?? [])
|
||||||
|
.map((tag) => tag.name.toLowerCase())
|
||||||
|
.includes(selectedTag.toLowerCase());
|
||||||
})
|
})
|
||||||
.filter((item) => {
|
.filter((item) => {
|
||||||
if (selectedConnectionType === '') {
|
if (selectedConnectionType === '') {
|
||||||
|
|
@ -139,7 +142,9 @@
|
||||||
if (selectedTag === '') {
|
if (selectedTag === '') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return (item.model?.tags ?? []).map((tag) => tag.name).includes(selectedTag);
|
return (item.model?.tags ?? [])
|
||||||
|
.map((tag) => tag.name.toLowerCase())
|
||||||
|
.includes(selectedTag.toLowerCase());
|
||||||
})
|
})
|
||||||
.filter((item) => {
|
.filter((item) => {
|
||||||
if (selectedConnectionType === '') {
|
if (selectedConnectionType === '') {
|
||||||
|
|
@ -315,7 +320,7 @@
|
||||||
tags = items
|
tags = items
|
||||||
.filter((item) => !(item.model?.info?.meta?.hidden ?? false))
|
.filter((item) => !(item.model?.info?.meta?.hidden ?? false))
|
||||||
.flatMap((item) => item.model?.tags ?? [])
|
.flatMap((item) => item.model?.tags ?? [])
|
||||||
.map((tag) => tag.name);
|
.map((tag) => tag.name.toLowerCase());
|
||||||
// Remove duplicates and sort
|
// Remove duplicates and sort
|
||||||
tags = Array.from(new Set(tags)).sort((a, b) => a.localeCompare(b));
|
tags = Array.from(new Set(tags)).sort((a, b) => a.localeCompare(b));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue