mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
build: Squashed commit of the following:
commit 3e4e2cb20a
Author: Krrish Dholakia <krrishdholakia@gmail.com>
Date: Tue Feb 4 15:10:34 2025 -0800
fix(proxy_server.py): fix redirect from `/sso/key/callback` to redirect on custom server path
Fixes https://github.com/BerriAI/litellm/issues/5997
This commit is contained in:
parent
75d9b02473
commit
df9056e9b7
2 changed files with 9 additions and 4 deletions
|
@ -425,7 +425,6 @@ async def proxy_startup_event(app: FastAPI):
|
|||
import json
|
||||
|
||||
init_verbose_loggers()
|
||||
|
||||
### LOAD MASTER KEY ###
|
||||
# check if master key set in environment - load from there
|
||||
master_key = get_secret("LITELLM_MASTER_KEY", None) # type: ignore
|
||||
|
@ -691,12 +690,18 @@ try:
|
|||
@app.middleware("http")
|
||||
async def redirect_ui_middleware(request: Request, call_next):
|
||||
if request.url.path.startswith("/ui"):
|
||||
new_path = request.url.path.replace("/ui", f"{server_root_path}/ui", 1)
|
||||
return RedirectResponse(new_path)
|
||||
new_url = str(request.url).replace("/ui", f"{server_root_path}/ui", 1)
|
||||
return RedirectResponse(new_url)
|
||||
return await call_next(request)
|
||||
|
||||
except Exception:
|
||||
pass
|
||||
# current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# ui_path = os.path.join(current_dir, "_experimental", "out")
|
||||
# # Mount this test directory instead
|
||||
# app.mount("/ui", StaticFiles(directory=ui_path, html=True), name="ui")
|
||||
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
|
|
|
@ -1725,7 +1725,7 @@ def _format_type(props, indent):
|
|||
|
||||
def token_counter(
|
||||
model="",
|
||||
custom_tokenizer: Optional[dict] = None,
|
||||
custom_tokenizer: Optional[Union[dict, SelectTokenizerResponse]] = None,
|
||||
text: Optional[Union[str, List[str]]] = None,
|
||||
messages: Optional[List] = None,
|
||||
count_response_tokens: Optional[bool] = False,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue