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:
G30 2025-10-30 13:44:05 -04:00 committed by GitHub
parent 292be82754
commit 8feed02d40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 8 deletions

View file

@ -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));
}
});

View file

@ -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));