mirror of
https://github.com/open-webui/open-webui
synced 2025-05-16 19:43:42 +00:00
Merge pull request #12431 from gaby/fix-12237
feat: Allow making content optional when listing all files
This commit is contained in:
commit
1e98ae7608
@ -162,11 +162,17 @@ def upload_file(
|
|||||||
|
|
||||||
|
|
||||||
@router.get("/", response_model=list[FileModelResponse])
|
@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":
|
if user.role == "admin":
|
||||||
files = Files.get_files()
|
files = Files.get_files()
|
||||||
else:
|
else:
|
||||||
files = Files.get_files_by_user_id(user.id)
|
files = Files.get_files_by_user_id(user.id)
|
||||||
|
|
||||||
|
if not include_content:
|
||||||
|
for file in files:
|
||||||
|
file.data["content"] = ""
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user