mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-01 03:46:23 +02:00
1. use English as much as possible.
2. handle callback in function, no need to set reraise=True in "@retry" 3. fix log format in loguru
This commit is contained in:
parent
6b9d5ef02f
commit
8da952a04c
1 changed files with 2 additions and 3 deletions
|
|
@ -117,10 +117,10 @@ class CostManager(metaclass=Singleton):
|
|||
|
||||
|
||||
def log_and_reraise(retry_state):
|
||||
logger.error("Retry attempts exhausted. Last exception: %s", retry_state.outcome.exception())
|
||||
logger.error(f"Retry attempts exhausted. Last exception: {retry_state.outcome.exception()}")
|
||||
logger.warning("""
|
||||
Recommend going to https://deepwisdom.feishu.cn/wiki/MsGnwQBjiif9c3koSJNcYaoSnu4#part-XdatdVlhEojeAfxaaEZcMV3ZniQ
|
||||
See FAQ 5.8 PRD卡住/无法访问/连接中断
|
||||
See FAQ 5.8
|
||||
""")
|
||||
raise retry_state.outcome.exception()
|
||||
|
||||
|
|
@ -216,7 +216,6 @@ class OpenAIGPTAPI(BaseGPTAPI, RateLimiter):
|
|||
wait=wait_fixed(1),
|
||||
after=after_log(logger, logging.WARNING),
|
||||
retry=retry_if_exception_type(APIConnectionError),
|
||||
reraise=True,
|
||||
retry_error_callback=log_and_reraise,
|
||||
)
|
||||
async def acompletion_text(self, messages: list[dict], stream=False) -> str:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue