mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Revert "fix(ui): keep litellm_credential_name from LiteLLM Params JSON when n…" (#39046)
This reverts commit 33cc9c1c48.
This commit is contained in:
parent
33cc9c1c48
commit
b473339ac0
3 changed files with 2 additions and 28 deletions
|
|
@ -87,6 +87,7 @@ const alwaysMounted = {
|
|||
api_key: undefined,
|
||||
api_base: undefined,
|
||||
custom_llm_provider: "openai",
|
||||
litellm_credential_name: null,
|
||||
model: "gpt-4o",
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -73,28 +73,4 @@ describe("prepareModelAddRequest", () => {
|
|||
expect(deployment.litellmParamsObj.litellm_credential_name).toBe("selected-credential");
|
||||
expect(deployment.litellmParamsObj.timeout).toBe(5);
|
||||
});
|
||||
|
||||
it("keeps litellm_credential_name from LiteLLM Params JSON when no credential is selected", async () => {
|
||||
const formValues = {
|
||||
model_mappings: [
|
||||
{
|
||||
public_name: "Public Model",
|
||||
litellm_model: "litellm/public",
|
||||
},
|
||||
],
|
||||
model_name: "custom-model-name",
|
||||
litellm_extra_params: JSON.stringify({
|
||||
litellm_credential_name: "from-json",
|
||||
timeout: 5,
|
||||
}),
|
||||
litellm_credential_name: null,
|
||||
};
|
||||
|
||||
const deployments = await prepareModelAddRequest({ ...formValues }, "token", null);
|
||||
|
||||
expect(deployments).toHaveLength(1);
|
||||
const [deployment] = deployments!;
|
||||
expect(deployment.litellmParamsObj.litellm_credential_name).toBe("from-json");
|
||||
expect(deployment.litellmParamsObj.timeout).toBe(5);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -91,9 +91,6 @@ export const prepareModelAddRequest = async (formValues: Record<string, any>, ac
|
|||
if (value === "") {
|
||||
continue;
|
||||
}
|
||||
if (key === "litellm_credential_name" && value == null) {
|
||||
continue;
|
||||
}
|
||||
// Skip the custom_pricing and pricing_model fields as they're only used for UI control
|
||||
if (key === "custom_pricing" || key === "pricing_model" || key === "cache_control") {
|
||||
continue;
|
||||
|
|
@ -127,7 +124,7 @@ export const prepareModelAddRequest = async (formValues: Record<string, any>, ac
|
|||
if (value && value != undefined) {
|
||||
try {
|
||||
litellmExtraParams = JSON.parse(value);
|
||||
if ("litellm_credential_name" in litellmExtraParams && formValues.litellm_credential_name) {
|
||||
if ("litellm_credential_name" in litellmExtraParams) {
|
||||
delete litellmExtraParams.litellm_credential_name;
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue