mirror of
https://github.com/open-webui/open-webui
synced 2025-05-25 07:14:43 +00:00
refac
This commit is contained in:
parent
1e98ae7608
commit
c1ff69721a
@ -162,17 +162,16 @@ def upload_file(
|
|||||||
|
|
||||||
|
|
||||||
@router.get("/", response_model=list[FileModelResponse])
|
@router.get("/", response_model=list[FileModelResponse])
|
||||||
async def list_files(
|
async def list_files(user=Depends(get_verified_user), content: bool = Query(True)):
|
||||||
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:
|
if not content:
|
||||||
for file in files:
|
for file in files:
|
||||||
file.data["content"] = ""
|
del file.data["content"]
|
||||||
|
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user