Browse Source

Merge pull request #12431 from gaby/fix-12237

feat: Allow making content optional when listing all files
Timothy Jaeryang Baek 3 months ago
parent
commit
1e98ae7608
1 changed files with 7 additions and 1 deletions
  1. 7 1
      backend/open_webui/routers/files.py

+ 7 - 1
backend/open_webui/routers/files.py

@@ -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