fix(ui): updateProxyBaseUrl hardcoded localhost:4000 overwrites NEXT_PUBLIC_LITELLM_PROXY_URL

updateProxyBaseUrl had its own copy of the localhost:4000 fallback.
When getUiConfig received proxy_base_url=null from the backend it used
that hardcoded value, immediately overwriting the correct URL set via
NEXT_PUBLIC_LITELLM_PROXY_URL.

Fix: use the module-level defaultProxyBaseUrl (which already respects
NEXT_PUBLIC_LITELLM_PROXY_URL) as the fallback inside updateProxyBaseUrl.

Also remove the dead Form.useForm() instance in CredentialsPanel that
was never connected to any <Form form={...}>, causing the Ant Design
"Instance created by useForm is not connected" console warning.

Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bytechoreographer 2026-04-16 16:34:15 +08:00
parent 04adf03077
commit 1dc0a2afa1
2 changed files with 1 additions and 6 deletions

View file

@ -17,7 +17,6 @@ import {
TableRow,
Text,
} from "@tremor/react";
import { Form } from "antd";
import { UploadProps } from "antd/es/upload";
import { useState } from "react";
import DeleteResourceModal from "../common_components/DeleteResourceModal";
@ -43,7 +42,6 @@ const CredentialsPanel: React.FC<CredentialsPanelProps> = ({ uploadProps }) => {
const [credentialToDelete, setCredentialToDelete] = useState<CredentialItem | null>(null);
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
const [isCredentialDeleting, setIsCredentialDeleting] = useState(false);
const [form] = Form.useForm();
const restrictedFields = ["credential_name", "custom_llm_provider"];
const handleUpdateCredential = async (values: any) => {

View file

@ -126,10 +126,7 @@ const updateProxyBaseUrl = (serverRootPath: string, receivedProxyBaseUrl: string
return;
}
const browserLocation = getWindowLocation();
const resolvedDefaultProxyBaseUrl =
isLocal && process.env.NEXT_PUBLIC_USE_REWRITES !== "true"
? "http://localhost:4000"
: browserLocation?.origin ?? null;
const resolvedDefaultProxyBaseUrl = defaultProxyBaseUrl ?? browserLocation?.origin ?? null;
let initialProxyBaseUrl = receivedProxyBaseUrl || resolvedDefaultProxyBaseUrl;
console.log("proxyBaseUrl:", proxyBaseUrl);
console.log("serverRootPath:", serverRootPath);