From 6ceceefc9f7b1b903d2ce541839ef8136079eeca Mon Sep 17 00:00:00 2001 From: 7w1 Date: Thu, 5 Mar 2026 15:19:15 -0600 Subject: [PATCH] fix pronoun clamp and swap update weight --- ...pronouns_based_on_the_pronouns_language.md | 2 +- src/app/utils/pronouns.ts | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.changeset/add_option_to_filter_user_pronouns_based_on_the_pronouns_language.md b/.changeset/add_option_to_filter_user_pronouns_based_on_the_pronouns_language.md index 390e3a43..12f23445 100644 --- a/.changeset/add_option_to_filter_user_pronouns_based_on_the_pronouns_language.md +++ b/.changeset/add_option_to_filter_user_pronouns_based_on_the_pronouns_language.md @@ -1,5 +1,5 @@ --- -sable: minor +sable: patch --- Add option to filter user pronouns based on the pronouns language diff --git a/src/app/utils/pronouns.ts b/src/app/utils/pronouns.ts index a306543c..63c6e29c 100644 --- a/src/app/utils/pronouns.ts +++ b/src/app/utils/pronouns.ts @@ -29,13 +29,22 @@ export function filterPronounsByLanguage( enabled: boolean, languages: string[] ): { summary: string; language?: string }[] { - if (!enabled) return pronouns; - const normalizedLanguages = languages.map((lang) => lang.trim().toLowerCase()); - const filteredPronouns = pronouns.filter((p) => - normalizedLanguages.includes((p.language || 'en').trim().toLowerCase()) - ); - if (filteredPronouns.length === 0) { - return pronouns; + if (!enabled) { + return pronouns.map((p) => ({ ...p, summary: p.summary.slice(0, 16) })); } + + const normalizedLanguages = languages.map((lang) => lang.trim().toLowerCase()); + + const filteredPronouns = pronouns + .filter((p) => normalizedLanguages.includes((p.language || 'en').trim().toLowerCase())) + .map((p) => ({ + ...p, + summary: p.summary.slice(0, 16), + })); + + if (filteredPronouns.length === 0) { + return pronouns.map((p) => ({ ...p, summary: p.summary.slice(0, 16) })); + } + return filteredPronouns; }