fix(model): preserve LM Studio '@' quant suffixes in model name resol… · openclaw/openclaw@5bb78ea
Bartok9
·
2026-04-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -80,6 +80,22 @@ describe("splitTrailingAuthProfile", () => {
|
80 | 80 | }); |
81 | 81 | }); |
82 | 82 | |
| 83 | +it("keeps @iq* importance-quantization suffixes in model ids", () => { |
| 84 | +expect(splitTrailingAuthProfile("lmstudio/qwen3.6-27b@iq3_xxs")).toEqual({ |
| 85 | +model: "lmstudio/qwen3.6-27b@iq3_xxs", |
| 86 | +}); |
| 87 | +expect(splitTrailingAuthProfile("lmstudio/qwen3.6-27b@iq4_xs")).toEqual({ |
| 88 | +model: "lmstudio/qwen3.6-27b@iq4_xs", |
| 89 | +}); |
| 90 | +}); |
| 91 | + |
| 92 | +it("supports auth profiles after @iq* quant suffixes", () => { |
| 93 | +expect(splitTrailingAuthProfile("lmstudio/qwen3.6-27b@iq3_xxs@work")).toEqual({ |
| 94 | +model: "lmstudio/qwen3.6-27b@iq3_xxs", |
| 95 | +profile: "work", |
| 96 | +}); |
| 97 | +}); |
| 98 | + |
83 | 99 | it("keeps @4bit/@8bit quant suffixes in model ids", () => { |
84 | 100 | expect(splitTrailingAuthProfile("lmstudio-mb-pro/gemma-4-31b@4bit")).toEqual({ |
85 | 101 | model: "lmstudio-mb-pro/gemma-4-31b@4bit", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -29,9 +29,12 @@ export function splitTrailingAuthProfile(raw: string): {
|
29 | 29 | // of the model id. These often use '@' (ex: gemma-4-31b-it@q8_0) which would |
30 | 30 | // otherwise be misinterpreted as an auth profile delimiter. |
31 | 31 | // |
| 32 | +// Covers standard GGUF quant tags (q4_0, q8_0, q4_k_xl, …) and importance- |
| 33 | +// quantization variants (iq3_xxs, iq4_xs, …) used by llama.cpp / LM Studio. |
| 34 | +// |
32 | 35 | // If an auth profile is needed, it can still be specified as a second suffix: |
33 | | -// lmstudio/foo@q8_0@work |
34 | | -if (/^(?:q\d+(?:_[a-z0-9]+)*|\d+bit)(?:@|$)/i.test(suffixAfterDelimiter())) { |
| 36 | +// lmstudio/foo@q8_0@work lmstudio/foo@iq3_xxs@work |
| 37 | +if (/^(?:i?q\d+(?:_[a-z0-9]+)*|\d+bit)(?:@|$)/i.test(suffixAfterDelimiter())) { |
35 | 38 | const nextDelimiter = trimmed.indexOf("@", profileDelimiter + 1); |
36 | 39 | if (nextDelimiter < 0) { |
37 | 40 | return { model: trimmed }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { splitTrailingAuthProfile } from "../agents/model-ref-profile.js"; |
1 | 2 | import { normalizeProviderId } from "../agents/provider-id.js"; |
2 | 3 | import { withBundledPluginVitestCompat } from "./bundled-compat.js"; |
3 | 4 | import { resolveEffectivePluginActivationState } from "./config-state.js"; |
@@ -353,9 +354,7 @@ function resolveManifestRegistry(params: {
|
353 | 354 | } |
354 | 355 | |
355 | 356 | function stripModelProfileSuffix(value: string): string { |
356 | | -const trimmed = value.trim(); |
357 | | -const at = trimmed.indexOf("@"); |
358 | | -return at <= 0 ? trimmed : trimmed.slice(0, at).trim(); |
| 357 | +return splitTrailingAuthProfile(value).model; |
359 | 358 | } |
360 | 359 | |
361 | 360 | function splitExplicitModelRef(rawModel: string): { provider?: string; modelId: string } | null { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。