mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
refactor(qa-lab): reuse model reference splitter (#130317)
This commit is contained in:
@@ -53,8 +53,11 @@ describe("qa runner model catalog", () => {
|
||||
);
|
||||
|
||||
await expect(loadQaRunnerModelOptions({ repoRoot })).resolves.toEqual([
|
||||
expect.objectContaining({ key: "openai/gpt-5.6-luna" }),
|
||||
expect.objectContaining({ key: "anthropic/claude-sonnet-4-6" }),
|
||||
expect.objectContaining({ key: "openai/gpt-5.6-luna", provider: "openai" }),
|
||||
expect.objectContaining({
|
||||
key: "anthropic/claude-sonnet-4-6",
|
||||
provider: "anthropic",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import path from "node:path";
|
||||
import { runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
|
||||
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
||||
import { QA_CHILD_STDERR_TAIL_BYTES, QA_CHILD_STDOUT_MAX_BYTES } from "./child-output.js";
|
||||
import { splitQaModelRef } from "./model-selection.js";
|
||||
import { resolveQaNodeExecPath } from "./node-exec.js";
|
||||
import {
|
||||
isPreferredQaLiveFrontierCatalogModel,
|
||||
@@ -33,22 +34,11 @@ export type QaRunnerModelOption = {
|
||||
preferred: boolean;
|
||||
};
|
||||
|
||||
function splitModelKey(key: string) {
|
||||
const slash = key.indexOf("/");
|
||||
if (slash <= 0 || slash === key.length - 1) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
provider: key.slice(0, slash),
|
||||
model: key.slice(slash + 1),
|
||||
};
|
||||
}
|
||||
|
||||
function selectQaRunnerModelOptions(rows: ModelRow[]): QaRunnerModelOption[] {
|
||||
const options = rows
|
||||
.filter((row) => row.available === true && !row.missing)
|
||||
.map((row) => {
|
||||
const parsed = splitModelKey(row.key);
|
||||
const parsed = splitQaModelRef(row.key);
|
||||
return {
|
||||
key: row.key,
|
||||
name: row.name,
|
||||
|
||||
Reference in New Issue
Block a user