mirror of
https://github.com/cline/cline.git
synced 2026-09-17 17:45:33 +08:00
Prevent injecting other models into the LiteLLM model list (#11771)
This commit is contained in:
@@ -296,6 +296,17 @@ describe("resolveProviderConfig", () => {
|
||||
capabilities: expect.arrayContaining(["images", "reasoning"]),
|
||||
}),
|
||||
);
|
||||
expect(resolved?.knownModels?.["private-proxy-model"]).toEqual(
|
||||
expect.objectContaining({
|
||||
name: "private-proxy-model",
|
||||
capabilities: expect.arrayContaining(["images", "reasoning"]),
|
||||
}),
|
||||
);
|
||||
expect(Object.keys(resolved?.knownModels ?? {}).sort()).toEqual([
|
||||
"openai/gpt-4o-mini",
|
||||
"private-proxy-model",
|
||||
]);
|
||||
expect(resolved?.knownModels?.["gpt-5.4"]).toBeUndefined();
|
||||
});
|
||||
|
||||
it("reports attempted path, auth header, status, and body for LiteLLM model fetch failures", async () => {
|
||||
|
||||
@@ -171,6 +171,16 @@ async function mergeKnownModels(
|
||||
...userKnownModels,
|
||||
});
|
||||
}
|
||||
// LiteLLM model access is configured by the user's proxy. When the proxy
|
||||
// returns a private model list, treat it as the authoritative allowlist so
|
||||
// the picker does not show bundled OpenAI-compatible catalog entries that the
|
||||
// proxy may not actually expose.
|
||||
if (providerId === "litellm" && Object.keys(privateModels).length > 0) {
|
||||
return Llms.sortModelsByReleaseDate({
|
||||
...privateModels,
|
||||
...userKnownModels,
|
||||
});
|
||||
}
|
||||
if (providerId === "openai-codex") {
|
||||
return Llms.sortModelsByReleaseDate({
|
||||
...defaultKnownModels,
|
||||
|
||||
Reference in New Issue
Block a user