mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix(proxy_server.py): fix loading ui on custom root path (#11912)
Closes https://github.com/BerriAI/litellm/issues/11865
This commit is contained in:
parent
40cc61c8f3
commit
0e6f1c089d
2 changed files with 21 additions and 60 deletions
|
|
@ -6957,49 +6957,6 @@
|
|||
"supports_web_search": true,
|
||||
"supports_pdf_input": true
|
||||
},
|
||||
"gemini/gemini-2.5-flash-lite-preview-06-17": {
|
||||
"max_tokens": 65535,
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 65535,
|
||||
"max_images_per_prompt": 3000,
|
||||
"max_videos_per_prompt": 10,
|
||||
"max_video_length": 1,
|
||||
"max_audio_length_hours": 8.4,
|
||||
"max_audio_per_prompt": 1,
|
||||
"max_pdf_size_mb": 30,
|
||||
"input_cost_per_audio_token": 5e-07,
|
||||
"input_cost_per_token": 1e-07,
|
||||
"output_cost_per_token": 4e-07,
|
||||
"output_cost_per_reasoning_token": 4e-07,
|
||||
"litellm_provider": "gemini",
|
||||
"mode": "chat",
|
||||
"supports_reasoning": true,
|
||||
"supports_system_messages": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_vision": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_audio_output": false,
|
||||
"supports_tool_choice": true,
|
||||
"supported_endpoints": [
|
||||
"/v1/chat/completions",
|
||||
"/v1/completions",
|
||||
"/v1/batch"
|
||||
],
|
||||
"supported_modalities": [
|
||||
"text",
|
||||
"image",
|
||||
"audio",
|
||||
"video"
|
||||
],
|
||||
"supported_output_modalities": [
|
||||
"text"
|
||||
],
|
||||
"source": "https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-lite",
|
||||
"supports_parallel_function_calling": true,
|
||||
"supports_web_search": true,
|
||||
"supports_url_context": true,
|
||||
"supports_pdf_input": true
|
||||
},
|
||||
"gemini/gemini-2.5-flash-lite-preview-06-17": {
|
||||
"max_tokens": 65535,
|
||||
"max_input_tokens": 1048576,
|
||||
|
|
@ -7042,7 +6999,8 @@
|
|||
"source": "https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-lite",
|
||||
"supports_parallel_function_calling": true,
|
||||
"supports_web_search": true,
|
||||
"supports_url_context": true
|
||||
"supports_url_context": true,
|
||||
"supports_pdf_input": true
|
||||
},
|
||||
"gemini-2.5-flash-preview-05-20": {
|
||||
"max_tokens": 65535,
|
||||
|
|
|
|||
|
|
@ -752,21 +752,6 @@ try:
|
|||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
ui_path = os.path.join(current_dir, "_experimental", "out")
|
||||
litellm_asset_prefix = "/litellm-asset-prefix"
|
||||
# # Mount the _next directory at the root level
|
||||
app.mount(
|
||||
"/_next",
|
||||
StaticFiles(directory=os.path.join(ui_path, "_next")),
|
||||
name="next_static",
|
||||
)
|
||||
app.mount(
|
||||
f"{litellm_asset_prefix}/_next",
|
||||
StaticFiles(directory=os.path.join(ui_path, "_next")),
|
||||
name="next_static",
|
||||
)
|
||||
# print(f"mounted _next at {server_root_path}/ui/_next")
|
||||
|
||||
app.mount("/ui", StaticFiles(directory=ui_path, html=True), name="ui")
|
||||
|
||||
# Iterate through files in the UI directory
|
||||
for root, dirs, files in os.walk(ui_path):
|
||||
for filename in files:
|
||||
|
|
@ -792,19 +777,37 @@ try:
|
|||
|
||||
# Replace the asset prefix with the server root path
|
||||
modified_content = content.replace(
|
||||
f"{litellm_asset_prefix}", server_root_path
|
||||
f"{litellm_asset_prefix}",
|
||||
f"{server_root_path}",
|
||||
)
|
||||
|
||||
# Replace the /.well-known/litellm-ui-config with the server root path
|
||||
modified_content = modified_content.replace(
|
||||
"/litellm/.well-known/litellm-ui-config",
|
||||
f"{server_root_path}/.well-known/litellm-ui-config",
|
||||
)
|
||||
|
||||
with open(file_path, "w", encoding="utf-8") as f:
|
||||
f.write(modified_content)
|
||||
except UnicodeDecodeError:
|
||||
# Skip binary files that can't be decoded
|
||||
continue
|
||||
|
||||
# # Mount the _next directory at the root level
|
||||
app.mount(
|
||||
"/_next",
|
||||
StaticFiles(directory=os.path.join(ui_path, "_next")),
|
||||
name="next_static",
|
||||
)
|
||||
app.mount(
|
||||
f"{litellm_asset_prefix}/_next",
|
||||
StaticFiles(directory=os.path.join(ui_path, "_next")),
|
||||
name="next_static",
|
||||
)
|
||||
# print(f"mounted _next at {server_root_path}/ui/_next")
|
||||
|
||||
app.mount("/ui", StaticFiles(directory=ui_path, html=True), name="ui")
|
||||
|
||||
# Handle HTML file restructuring
|
||||
for filename in os.listdir(ui_path):
|
||||
if filename.endswith(".html") and filename != "index.html":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue