mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
fix: de-duplicate model tags case-insensitively (#18716)
* fix: de-duplicate model tags case-insensitively This change updates the `setTags` function in the `Models.svelte` component and the `onMount` function in the `Selector.svelte` component to convert all model tags to lowercase before removing duplicates. This ensures that tags with different capitalization (e.g., "Best" and "best") are treated as a single tag, preventing duplicate entries in the tag filter dropdown on both the workspace models page and the new chat page. * Update Selector.svelte * refac
This commit is contained in:
parent
292be82754
commit
8feed02d40
2 changed files with 11 additions and 8 deletions
|
|
@ -312,13 +312,16 @@
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (items) {
|
if (items) {
|
||||||
tags = items
|
tags = Array.from(
|
||||||
.filter((item) => !(item.model?.info?.meta?.hidden ?? false))
|
new Set(
|
||||||
.flatMap((item) => item.model?.tags ?? [])
|
items
|
||||||
.map((tag) => tag.name);
|
.filter((item) => !(item.model?.info?.meta?.hidden ?? false))
|
||||||
|
.flatMap((item) => item.model?.tags ?? [])
|
||||||
// Remove duplicates and sort
|
.map((tag) => tag.name.toLowerCase())
|
||||||
tags = Array.from(new Set(tags)).sort((a, b) => a.localeCompare(b));
|
)
|
||||||
|
)
|
||||||
|
.sort((a, b) => a.localeCompare(b))
|
||||||
|
.map((tag) => capitalizeFirstLetter(tag));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@
|
||||||
tags = models
|
tags = models
|
||||||
.filter((model) => !(model?.meta?.hidden ?? false))
|
.filter((model) => !(model?.meta?.hidden ?? false))
|
||||||
.flatMap((model) => model?.meta?.tags ?? [])
|
.flatMap((model) => model?.meta?.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