diff --git a/metagpt/actions/write_code_review.py b/metagpt/actions/write_code_review.py index f9cebffac..e0a538fc8 100644 --- a/metagpt/actions/write_code_review.py +++ b/metagpt/actions/write_code_review.py @@ -94,7 +94,7 @@ class WriteCodeReview(Action): def __init__(self, name="WriteCodeReview", context=None, llm=None): super().__init__(name, context, llm) - @retry(stop=stop_after_attempt(2), wait=wait_random_exponential(min=1, max=60)) + @retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) async def write_code_review_and_rewrite(self, prompt): code_rsp = await self._aask(prompt) result = CodeParser.parse_block("Code Review Result", code_rsp) diff --git a/metagpt/document_store/faiss_store.py b/metagpt/document_store/faiss_store.py index 53725c3f9..b1faa3538 100644 --- a/metagpt/document_store/faiss_store.py +++ b/metagpt/document_store/faiss_store.py @@ -5,6 +5,7 @@ @Author : alexanderwu @File : faiss_store.py """ +import asyncio import pickle from pathlib import Path from typing import Optional @@ -58,6 +59,9 @@ class FaissStore(LocalStore): else: return str(sep.join([f"{x.page_content}" for x in rsp])) + async def asearch(self, *args, **kwargs): + return await asyncio.to_thread(self.search, *args, **kwargs) + def write(self): """Initialize the index and library based on the Document (JSON / XLSX, etc.) file provided by the user.""" if not self.raw_data_path.exists(): diff --git a/tests/conftest.py b/tests/conftest.py index 0cef6a4c9..b22e43e79 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,6 +7,7 @@ """ import asyncio +import logging import re from unittest.mock import Mock