mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
fix(model-ref): recompute suffix after @YYYYMMDD + add @8bit test
This commit is contained in:
committed by
Peter Steinberger
parent
5208a85afe
commit
02c092e558
@@ -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",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user