Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
zMardone committed Jul 17, 2024
1 parent 30d691c commit 7f4a7f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 10 additions & 2 deletions app/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@ def index_file_data(content_base: Dict) -> bool:

@celery.task(name="save_file")
def start_save(
storage: IStorage,
docs: List[Document]
docs: List[Document],
search_results: List[Dict]
) -> bool:
from app.main import main_app

ids = []
if len(search_results) > 0:
ids = [item["_id"] for item in search_results]
main_app.content_base_vectorstore.delete(ids=ids)

storage = main_app.content_base_vectorstore
return storage.save(docs)
7 changes: 2 additions & 5 deletions app/indexer/content_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ def index_documents(self, docs: List[Document]):
file_uuid=file_uuid,
)
print("end _search_docs_by_content_base_uuid")
ids = []
if len(results) > 0:
ids = [item["_id"] for item in results]
self.storage.delete(ids=ids)

print("start save")

task_status = start_save.delay(storage=self.storage, docs=docs)
task_status = start_save.delay(search_results=results, docs=docs)
return task_status.wait()

def index(self, texts: List, metadatas: dict):
Expand Down

0 comments on commit 7f4a7f5

Please sign in to comment.