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 () => {
|
||||
if (items) {
|
||||
tags = items
|
||||
tags = Array.from(
|
||||
new Set(
|
||||
items
|
||||
.filter((item) => !(item.model?.info?.meta?.hidden ?? false))
|
||||
.flatMap((item) => item.model?.tags ?? [])
|
||||
.map((tag) => tag.name);
|
||||
|
||||
// Remove duplicates and sort
|
||||
tags = Array.from(new Set(tags)).sort((a, b) => a.localeCompare(b));
|
||||
.map((tag) => tag.name.toLowerCase())
|
||||
)
|
||||
)
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
.map((tag) => capitalizeFirstLetter(tag));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@
|
|||
tags = models
|
||||
.filter((model) => !(model?.meta?.hidden ?? false))
|
||||
.flatMap((model) => model?.meta?.tags ?? [])
|
||||
.map((tag) => tag.name);
|
||||
.map((tag) => tag.name.toLowerCase());
|
||||
|
||||
// Remove duplicates and sort
|
||||
tags = Array.from(new Set(tags)).sort((a, b) => a.localeCompare(b));
|
||||
|
|
|
|||
Loading…
Reference in a new issue