浏览代码

Add content param to /search route

Juan Calderon-Perez 6 月之前
父节点
当前提交
fed47f2e2b
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      backend/open_webui/routers/files.py

+ 6 - 0
backend/open_webui/routers/files.py

@@ -189,6 +189,7 @@ async def search_files(
         ...,
         ...,
         description="Filename pattern to search for. Supports wildcards such as '*.txt'",
         description="Filename pattern to search for. Supports wildcards such as '*.txt'",
     ),
     ),
+    content: bool = Query(True),
     user=Depends(get_verified_user),
     user=Depends(get_verified_user),
 ):
 ):
     """
     """
@@ -210,6 +211,11 @@ async def search_files(
             status_code=status.HTTP_404_NOT_FOUND,
             status_code=status.HTTP_404_NOT_FOUND,
             detail="No files found matching the pattern.",
             detail="No files found matching the pattern.",
         )
         )
+
+    if not content:
+        for file in matching_files:
+            del file.data["content"]
+
     return matching_files
     return matching_files