mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-19 00:01:29 +00:00
fix(proxy): unblock CI - drop banned casts, gate missing request method, fix ui lint
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
2bc38b0b65
commit
8c2e910d8a
7 changed files with 16 additions and 25 deletions
|
|
@ -10,7 +10,7 @@ import secrets
|
|||
from collections.abc import Mapping
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from types import MappingProxyType
|
||||
from typing import TYPE_CHECKING, Final, Literal, cast
|
||||
from typing import TYPE_CHECKING, Final, Literal
|
||||
|
||||
import jwt
|
||||
from fastapi import HTTPException
|
||||
|
|
@ -263,11 +263,8 @@ async def authenticate_user(
|
|||
) = None
|
||||
|
||||
if prisma_client is not None:
|
||||
_user_row = cast(
|
||||
LiteLLM_UserTable | None,
|
||||
await UserRepository(prisma_client).table.find_first(
|
||||
where={"user_email": {"equals": username, "mode": "insensitive"}}
|
||||
),
|
||||
_user_row = await UserRepository(prisma_client).table.find_first(
|
||||
where={"user_email": {"equals": username, "mode": "insensitive"}}
|
||||
)
|
||||
|
||||
"""
|
||||
|
|
@ -414,7 +411,7 @@ async def authenticate_user(
|
|||
user_id=user_id,
|
||||
key=key,
|
||||
user_email=user_email,
|
||||
user_role=cast(str, user_role),
|
||||
user_role=user_role.value if user_role is not None else LitellmUserRoles.INTERNAL_USER_VIEW_ONLY.value,
|
||||
login_method="username_password",
|
||||
password_reset_required=password_reset_required,
|
||||
)
|
||||
|
|
@ -458,7 +455,7 @@ def encode_ui_session_jwt(returned_ui_token_object: ReturnedUITokenObject, maste
|
|||
master key rotates, and the session-cookie readers that require a bounded lifetime
|
||||
(the MCP interactive sign-in) reject it.
|
||||
"""
|
||||
claims: Final = {**cast(dict, returned_ui_token_object), "exp": _ui_session_exp_timestamp()}
|
||||
claims: Final = {**returned_ui_token_object, "exp": _ui_session_exp_timestamp()}
|
||||
return jwt.encode(claims, master_key, algorithm="HS256")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from collections.abc import Mapping, Sequence
|
||||
from typing import Final, Literal, cast
|
||||
from typing import Final, Literal
|
||||
|
||||
from pydantic import TypeAdapter
|
||||
from typing_extensions import TypedDict, assert_never
|
||||
|
|
@ -109,11 +109,9 @@ def stored_credentials_present() -> bool:
|
|||
|
||||
if not isinstance(llm_router, Router):
|
||||
return False
|
||||
model_list: Final = cast(
|
||||
"list[object]",
|
||||
llm_router.model_list or [], # pyright: ignore[reportUnknownMemberType] # Router.model_list is declared bare `list`; elements are validated by the TypeAdapter below
|
||||
deployments: Final = _DEPLOYMENT_MARKERS.validate_python(
|
||||
llm_router.model_list or [] # pyright: ignore[reportUnknownMemberType] # Router.model_list is declared bare `list`; elements are validated by the TypeAdapter
|
||||
)
|
||||
deployments: Final = _DEPLOYMENT_MARKERS.validate_python(model_list)
|
||||
return any((d.get("model_info") or {}).get("db_model") is True for d in deployments)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1366,7 +1366,7 @@ async def _user_api_key_auth_builder(
|
|||
_lockout_reason is not None
|
||||
and master_key_lockout_action(
|
||||
route=route,
|
||||
method=request.method,
|
||||
method=request.scope.get("method") or "",
|
||||
reason=_lockout_reason,
|
||||
stored_credentials_present=stored_credentials_present(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def _user_table(
|
|||
)
|
||||
async def change_password(
|
||||
data: ChangePasswordRequest,
|
||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), # noqa: B008 # FastAPI dependency injection
|
||||
) -> ChangePasswordResponse:
|
||||
"""
|
||||
Change the calling user's own password.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from prisma import Json
|
|||
|
||||
from litellm.proxy.utils import hash_token
|
||||
|
||||
MASTER_KEY = "sk-1234"
|
||||
MASTER_KEY = "sk-litellm-behavior-master-key"
|
||||
SCRATCH_PREFIX = "scratch-"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,7 @@
|
|||
"count": 1
|
||||
},
|
||||
"prefer-const": {
|
||||
"count": 2
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"src/app/(dashboard)/search-tools/_components/SearchTools.tsx": {
|
||||
|
|
@ -1785,7 +1785,7 @@
|
|||
"count": 1
|
||||
},
|
||||
"prefer-const": {
|
||||
"count": 5
|
||||
"count": 4
|
||||
},
|
||||
"react-hooks/set-state-in-effect": {
|
||||
"count": 1
|
||||
|
|
|
|||
|
|
@ -298,13 +298,9 @@ export default function ModelInfoView({
|
|||
custom_llm_provider: localModelData.litellm_params?.custom_llm_provider,
|
||||
},
|
||||
};
|
||||
toast.info("Storing credential..");
|
||||
try {
|
||||
await credentialCreateCall(accessToken, credentialItem);
|
||||
toast.success("Credential stored successfully");
|
||||
} catch (error) {
|
||||
toast.fromError(error);
|
||||
}
|
||||
await credentialCreateCall(accessToken, credentialItem)
|
||||
.then(() => toast.success("Credential stored successfully"))
|
||||
.catch((error) => toast.fromError(error));
|
||||
};
|
||||
|
||||
const handleModelUpdate = async (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue