mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:30:42 +00:00
fix(release): quote Parallels model config paths
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { providerIdFromModelId, providerTimeoutConfigJson } from "./provider-auth.ts";
|
||||
import {
|
||||
configPathMapKey,
|
||||
providerIdFromModelId,
|
||||
providerTimeoutConfigJson,
|
||||
} from "./provider-auth.ts";
|
||||
|
||||
export function psSingleQuote(value: string): string {
|
||||
return `'${value.replaceAll("'", "''")}'`;
|
||||
@@ -26,7 +30,7 @@ export function windowsModelProviderTimeoutScript(modelId: string): string {
|
||||
value: JSON.parse(configJson) as unknown,
|
||||
},
|
||||
{
|
||||
path: `agents.defaults.models.${modelId}`,
|
||||
path: `agents.defaults.models${configPathMapKey(modelId)}`,
|
||||
value: {
|
||||
alias: "GPT",
|
||||
params: {
|
||||
|
||||
@@ -122,6 +122,10 @@ export function modelTransportConfigJson(modelId: string): string {
|
||||
});
|
||||
}
|
||||
|
||||
export function configPathMapKey(key: string): string {
|
||||
return `[${JSON.stringify(key)}]`;
|
||||
}
|
||||
|
||||
export function modelProviderConfigBatchJson(modelId: string, platform: Platform): string {
|
||||
const commands: Array<{ path: string; value: unknown }> = [];
|
||||
const providerId = providerIdFromModelId(modelId);
|
||||
@@ -135,7 +139,7 @@ export function modelProviderConfigBatchJson(modelId: string, platform: Platform
|
||||
const modelTransportConfig = modelTransportConfigJson(modelId);
|
||||
if (modelTransportConfig) {
|
||||
commands.push({
|
||||
path: `agents.defaults.models.${modelId}`,
|
||||
path: `agents.defaults.models${configPathMapKey(modelId)}`,
|
||||
value: JSON.parse(modelTransportConfig) as unknown,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -103,6 +103,21 @@ describe("Parallels smoke model selection", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("writes full model ids as config map keys in provider batches", () => {
|
||||
const source = `
|
||||
import { modelProviderConfigBatchJson } from "./${TS_PATHS.common}";
|
||||
const result = modelProviderConfigBatchJson("openai/gpt-4.1-mini", "windows");
|
||||
console.log(result);
|
||||
`;
|
||||
const batch = JSON.parse(runTsEval(source, { OPENAI_API_KEY: "sk-openai" })) as Array<{
|
||||
path: string;
|
||||
}>;
|
||||
|
||||
expect(batch.map((entry) => entry.path)).toContain(
|
||||
'agents.defaults.models["openai/gpt-4.1-mini"]',
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps snapshot, host, package, and quote helpers shared", () => {
|
||||
const common = readFileSync(TS_PATHS.common, "utf8");
|
||||
const hostCommand = readFileSync(TS_PATHS.hostCommand, "utf8");
|
||||
@@ -488,7 +503,8 @@ console.log(JSON.stringify(result));
|
||||
expect(powershell).toContain("windowsOpenClawResolver");
|
||||
expect(powershell).toContain("providerTimeoutConfigJson");
|
||||
expect(powershell).toContain("models.providers.${providerId}");
|
||||
expect(powershell).toContain("agents.defaults.models.${modelId}");
|
||||
expect(powershell).toContain("agents.defaults.models${configPathMapKey(modelId)}");
|
||||
expect(powershell).toContain("configPathMapKey");
|
||||
expect(powershell).toContain('transport: "sse"');
|
||||
expect(powershell).toContain("Resolve-OpenClawCommand");
|
||||
expect(powershell).toContain("npm\\node_modules\\openclaw\\openclaw.mjs");
|
||||
|
||||
Reference in New Issue
Block a user