mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(networking.tsx): update proxy base url with custom root path
This commit is contained in:
parent
c8240c41df
commit
acf0fa803c
3 changed files with 16 additions and 3 deletions
|
|
@ -45,4 +45,4 @@ async def health_check():
|
|||
|
||||
if __name__ == "__main__":
|
||||
# Run the server on port 8000
|
||||
uvicorn.run(app, host="0.0.0.0", port=8000, log_level="info")
|
||||
uvicorn.run(app, host="0.0.0.0", port=4000, log_level="info")
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import ChatUI from "@/components/chat_ui";
|
|||
import Sidebar from "@/components/leftnav";
|
||||
import Usage from "@/components/usage";
|
||||
import CacheDashboard from "@/components/cache_dashboard";
|
||||
import { proxyBaseUrl, setGlobalLitellmHeaderName } from "@/components/networking";
|
||||
import { proxyBaseUrl, setGlobalLitellmHeaderName, updateProxyBaseUrl } from "@/components/networking";
|
||||
import { Organization } from "@/components/networking";
|
||||
import GuardrailsPanel from "@/components/guardrails";
|
||||
import TransformRequestPanel from "@/components/transform_request";
|
||||
|
|
@ -214,6 +214,10 @@ export default function CreateKeyPage() {
|
|||
if (decoded.user_id) {
|
||||
setUserID(decoded.user_id);
|
||||
}
|
||||
|
||||
if (decoded.server_root_path) {
|
||||
updateProxyBaseUrl(decoded.server_root_path);
|
||||
}
|
||||
}
|
||||
}, [token]);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,20 @@ import { UserInfo } from "./view_users/types";
|
|||
import { EmailEventSettingsResponse, EmailEventSettingsUpdateRequest } from "./email_events/types";
|
||||
|
||||
const isLocal = process.env.NODE_ENV === "development";
|
||||
export const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
|
||||
export let proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
|
||||
if (isLocal != true) {
|
||||
console.log = function() {};
|
||||
}
|
||||
|
||||
export const updateProxyBaseUrl = (serverRootPath: string) => {
|
||||
if (proxyBaseUrl) {
|
||||
// check if proxybase url already ends with server root path, if not add it
|
||||
if (!proxyBaseUrl.endsWith(serverRootPath)) {
|
||||
proxyBaseUrl = `${proxyBaseUrl}${serverRootPath}`;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const HTTP_REQUEST = {
|
||||
GET: "GET",
|
||||
POST: "POST",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue