fix(model-ref): recompute suffix after @YYYYMMDD + add @8bit test

This commit is contained in:
foxtrot026
2026-04-04 15:36:54 -07:00
committed by Peter Steinberger
parent 5208a85afe
commit 02c092e558
2 changed files with 6 additions and 3 deletions

View File

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

View File

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