|
@@ -49,7 +49,8 @@ class R2RFileService(OSSFileService):
|
|
|
await f.write(content)
|
|
|
|
|
|
# storage.save_from_path(filename=file_key, local_file_path=tmp_file_path)
|
|
|
- r2r = await R2R().init()
|
|
|
+ r2r = await R2R()
|
|
|
+ r2r.init()
|
|
|
fileinfo = await r2r.ingest_file(
|
|
|
file_path=tmp_file_path,
|
|
|
metadata={"file_key": file_key, "title": file.filename},
|
|
@@ -121,7 +122,8 @@ class R2RFileService(OSSFileService):
|
|
|
r2r.search(query, filters={"file_key": {"$in": file_keys}})
|
|
|
)
|
|
|
"""
|
|
|
- r2r = R2R().init_sync()
|
|
|
+ r2r = R2R()
|
|
|
+ r2r.init_sync()
|
|
|
search_results = r2r.search(query, filters=filters)
|
|
|
|
|
|
if not search_results:
|
|
@@ -154,7 +156,8 @@ class R2RFileService(OSSFileService):
|
|
|
asyncio.run(r2r.init())
|
|
|
list_results = asyncio.run(r2r.list(ids=ids, offset=offset, limit=limit))
|
|
|
"""
|
|
|
- r2r = R2R().init_sync()
|
|
|
+ r2r = R2R()
|
|
|
+ r2r.init_sync()
|
|
|
list_results = r2r.list(ids=ids, offset=offset, limit=limit)
|
|
|
return list_results
|
|
|
|
|
@@ -175,14 +178,16 @@ class R2RFileService(OSSFileService):
|
|
|
r2r.list_documents(id=id, offset=offset, limit=limit)
|
|
|
)
|
|
|
"""
|
|
|
- r2r = R2R().init_sync()
|
|
|
+ r2r = R2R()
|
|
|
+ r2r.init_sync()
|
|
|
list_results = r2r.list_documents(id=id, offset=offset, limit=limit)
|
|
|
return list_results
|
|
|
|
|
|
@staticmethod
|
|
|
def list_chunks(ids: list[str]) -> dict:
|
|
|
if len(ids) > 0:
|
|
|
- r2r = R2R().init_sync()
|
|
|
+ r2r = R2R()
|
|
|
+ r2r.init_sync()
|
|
|
list_results = r2r.list_chunks(ids=ids)
|
|
|
|
|
|
files = {}
|