Skip to content

Commit 4a77350

Browse files
committed
refactor(qa-lab): reuse model reference splitter
1 parent 972b0c4 commit 4a77350

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

‎extensions/qa-lab/src/model-catalog.runtime.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ describe("qa runner model catalog", () => {
5353
);
5454

5555
await expect(loadQaRunnerModelOptions({ repoRoot })).resolves.toEqual([
56-
expect.objectContaining({ key: "openai/gpt-5.6-luna" }),
57-
expect.objectContaining({ key: "anthropic/claude-sonnet-4-6" }),
56+
expect.objectContaining({ key: "openai/gpt-5.6-luna", provider: "openai" }),
57+
expect.objectContaining({
58+
key: "anthropic/claude-sonnet-4-6",
59+
provider: "anthropic",
60+
}),
5861
]);
5962
});
6063

‎extensions/qa-lab/src/model-catalog.runtime.ts‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import path from "node:path";
44
import { runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
55
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
66
import { QA_CHILD_STDERR_TAIL_BYTES, QA_CHILD_STDOUT_MAX_BYTES } from "./child-output.js";
7+
import { splitQaModelRef } from "./model-selection.js";
78
import { resolveQaNodeExecPath } from "./node-exec.js";
89
import {
910
isPreferredQaLiveFrontierCatalogModel,
@@ -33,22 +34,11 @@ export type QaRunnerModelOption = {
3334
preferred: boolean;
3435
};
3536

36-
function splitModelKey(key: string) {
37-
const slash = key.indexOf("/");
38-
if (slash <= 0 || slash === key.length - 1) {
39-
return null;
40-
}
41-
return {
42-
provider: key.slice(0, slash),
43-
model: key.slice(slash + 1),
44-
};
45-
}
46-
4737
function selectQaRunnerModelOptions(rows: ModelRow[]): QaRunnerModelOption[] {
4838
const options = rows
4939
.filter((row) => row.available === true && !row.missing)
5040
.map((row) => {
51-
const parsed = splitModelKey(row.key);
41+
const parsed = splitQaModelRef(row.key);
5242
return {
5343
key: row.key,
5444
name: row.name,

0 commit comments

Comments
 (0)