diff --git a/backend/open_webui/routers/files.py b/backend/open_webui/routers/files.py index 22e1269e3..bfdb2be6a 100644 --- a/backend/open_webui/routers/files.py +++ b/backend/open_webui/routers/files.py @@ -162,11 +162,17 @@ def upload_file( @router.get("/", response_model=list[FileModelResponse]) -async def list_files(user=Depends(get_verified_user)): +async def list_files( + user=Depends(get_verified_user), include_content: bool = Query(True) +): if user.role == "admin": files = Files.get_files() else: files = Files.get_files_by_user_id(user.id) + + if not include_content: + for file in files: + file.data["content"] = "" return files