jack 1 هفته پیش
والد
کامیت
a54144a237
2فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 5 5
      app/providers/r2r.py
  2. 1 1
      app/services/file/impl/r2r_file.py

+ 5 - 5
app/providers/r2r.py

@@ -81,8 +81,8 @@ class R2R:
         )
         print("vvvvvvvvvvvvvvvvvvmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm")
         # print(search_response)
-        print(search_response["results"])
-        return search_response["results"]["chunk_search_results"]
+        print(search_response.results)
+        return search_response.results["chunk_search_results"]
 
     def list_chunks(self, ids: list[str] = []):
         self._check_login_sync()
@@ -93,7 +93,7 @@ class R2R:
         allfile = []
         for id in ids:
             listed = self.client_sync.documents.list_chunks(id=id)
-            allfile += listed["results"]
+            allfile += listed.results
         return allfile
 
     def list_documents(
@@ -116,8 +116,8 @@ class R2R:
                 listed = self.client_sync.collections.list_documents(
                     id=id, limit=limit, offset=offset
                 )
-                print(listed["results"])
-                return listed["results"]
+                print(listed.results)
+                return listed.results
             except Exception as e:
                 print(e)
                 listed = []

+ 1 - 1
app/services/file/impl/r2r_file.py

@@ -54,7 +54,7 @@ class R2RFileService(OSSFileService):
                 file_path=tmp_file_path,
                 metadata={"file_key": file_key, "title": file.filename},
             )
-            fileinfo = fileinfo["results"]
+            fileinfo = fileinfo.results
         # 存储
         db_file = File(
             purpose=purpose,