diff --git a/src/agents/model-ref-profile.test.ts b/src/agents/model-ref-profile.test.ts index f1eccdc431a..a8fb98b4bff 100644 --- a/src/agents/model-ref-profile.test.ts +++ b/src/agents/model-ref-profile.test.ts @@ -84,5 +84,8 @@ describe("splitTrailingAuthProfile", () => { expect(splitTrailingAuthProfile("lmstudio-mb-pro/gemma-4-31b@4bit")).toEqual({ model: "lmstudio-mb-pro/gemma-4-31b@4bit", }); + expect(splitTrailingAuthProfile("lmstudio-mb-pro/gemma-4-31b@8bit")).toEqual({ + model: "lmstudio-mb-pro/gemma-4-31b@8bit", + }); }); }); diff --git a/src/agents/model-ref-profile.ts b/src/agents/model-ref-profile.ts index 519874e69d6..2469bf228af 100644 --- a/src/agents/model-ref-profile.ts +++ b/src/agents/model-ref-profile.ts @@ -13,11 +13,11 @@ export function splitTrailingAuthProfile(raw: string): { return { model: trimmed }; } - const versionSuffix = trimmed.slice(profileDelimiter + 1); + const suffixAfterDelimiter = () => trimmed.slice(profileDelimiter + 1); // Keep well-known "version" suffixes (ex: @20251001) as part of the model id, // but allow an auth profile suffix *after* them (ex: ...@20251001@work). - if (/^\d{8}(?:@|$)/.test(versionSuffix)) { + if (/^\d{8}(?:@|$)/.test(suffixAfterDelimiter())) { const nextDelimiter = trimmed.indexOf("@", profileDelimiter + 9); if (nextDelimiter < 0) { return { model: trimmed }; @@ -31,7 +31,7 @@ export function splitTrailingAuthProfile(raw: string): { // // If an auth profile is needed, it can still be specified as a second suffix: // lmstudio/foo@q8_0@work - if (/^(?:q\d+(?:_[a-z0-9]+)*|\d+bit)(?:@|$)/i.test(versionSuffix)) { + if (/^(?:q\d+(?:_[a-z0-9]+)*|\d+bit)(?:@|$)/i.test(suffixAfterDelimiter())) { const nextDelimiter = trimmed.indexOf("@", profileDelimiter + 1); if (nextDelimiter < 0) { return { model: trimmed };