mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 08:40:22 +00:00
fix(session-status): infer custom runtime providers from config (#58474)
* fix(session-status): infer custom runtime providers from config * test(session-status): satisfy custom provider type checks
This commit is contained in:
@@ -284,7 +284,7 @@ describe("model-selection", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
expect(
|
||||
inferUniqueProviderFromConfiguredModels({
|
||||
@@ -304,7 +304,7 @@ describe("model-selection", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
expect(
|
||||
inferUniqueProviderFromConfiguredModels({
|
||||
@@ -323,7 +323,7 @@ describe("model-selection", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
expect(
|
||||
inferUniqueProviderFromConfiguredModels({
|
||||
@@ -342,7 +342,7 @@ describe("model-selection", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
expect(
|
||||
inferUniqueProviderFromConfiguredModels({
|
||||
@@ -351,6 +351,47 @@ describe("model-selection", () => {
|
||||
}),
|
||||
).toBe("vercel-ai-gateway");
|
||||
});
|
||||
|
||||
it("infers provider from configured provider catalogs when allowlist is absent", () => {
|
||||
const cfg = {
|
||||
models: {
|
||||
providers: {
|
||||
"qwen-dashscope": {
|
||||
models: [{ id: "qwen-max" }],
|
||||
},
|
||||
},
|
||||
},
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
expect(
|
||||
inferUniqueProviderFromConfiguredModels({
|
||||
cfg,
|
||||
model: "qwen-max",
|
||||
}),
|
||||
).toBe("qwen-dashscope");
|
||||
});
|
||||
|
||||
it("returns undefined when provider catalog matches are ambiguous", () => {
|
||||
const cfg = {
|
||||
models: {
|
||||
providers: {
|
||||
"qwen-dashscope": {
|
||||
models: [{ id: "qwen-max" }],
|
||||
},
|
||||
modelstudio: {
|
||||
models: [{ id: "qwen-max" }],
|
||||
},
|
||||
},
|
||||
},
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
expect(
|
||||
inferUniqueProviderFromConfiguredModels({
|
||||
cfg,
|
||||
model: "qwen-max",
|
||||
}),
|
||||
).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildModelAliasIndex", () => {
|
||||
|
||||
Reference in New Issue
Block a user