fix: temp chat not working

This commit is contained in:
Timothy Jaeryang Baek 2025-08-13 19:18:30 +04:00
parent e7d9755d97
commit ff55ca4d75

View file

@ -1286,7 +1286,9 @@ async def get_models(
if (
(user.role == "admin" and ENABLE_ADMIN_WORKSPACE_CONTENT_ACCESS)
or user.id == model_info.user_id
or has_access(user.id, type="read", access_control=model_info.access_control)
or has_access(
user.id, type="read", access_control=model_info.access_control
)
):
filtered_models.append(model)
@ -1328,7 +1330,10 @@ async def get_models(
)
# Filter out models that the user does not have access to
if (user.role == "user" or (user.role == "admin" and not ENABLE_ADMIN_WORKSPACE_CONTENT_ACCESS)) and not BYPASS_MODEL_ACCESS_CONTROL:
if (
user.role == "user"
or (user.role == "admin" and not ENABLE_ADMIN_WORKSPACE_CONTENT_ACCESS)
) and not BYPASS_MODEL_ACCESS_CONTROL:
models = get_filtered_models(models, user)
log.debug(
@ -1453,6 +1458,7 @@ async def chat_completion(
}
if metadata.get("chat_id") and (user and user.role != "admin"):
if metadata["chat_id"] != "local":
chat = Chats.get_chat_by_id_and_user_id(metadata["chat_id"], user.id)
if chat is None:
raise HTTPException(