diff --git a/fjerkroa_bot/ai_responder.py b/fjerkroa_bot/ai_responder.py index f9db137..b46d6be 100644 --- a/fjerkroa_bot/ai_responder.py +++ b/fjerkroa_bot/ai_responder.py @@ -184,7 +184,7 @@ class AIResponder(object): ) as response: response = await response.json() if "sdGenerationJob" not in response: - logging.warning(f"No 'sdGenerationJob' found in response: {repr(response)}") + logging.warning(f"No 'sdGenerationJob' found in response, sleep for {error_sleep}s: {repr(response)}") await asyncio.sleep(error_sleep) continue generation_id = response["sdGenerationJob"]["generationId"] @@ -195,7 +195,7 @@ class AIResponder(object): ) as response: response = await response.json() if "generations_by_pk" not in response: - logging.warning(f"Unexpected response: {repr(response)}") + logging.warning(f"Unexpected response, sleep for {error_sleep}s: {repr(response)}") await asyncio.sleep(error_sleep) continue if len(response["generations_by_pk"]["generated_images"]) == 0: @@ -212,9 +212,10 @@ class AIResponder(object): logging.info(f'Drawed a picture with leonardo AI on this description: {repr(description)}') return image_bytes except Exception as err: - logging.warning(f"Failed to generate image: {repr(description)}\n{repr(err)}") + logging.warning(f"Failed to generate image, sleep for {error_sleep}s: {repr(description)}\n{repr(err)}") else: - logging.warning(f"Failed to generate image: {repr(description)}") + logging.warning(f"Failed to generate image, sleep for {error_sleep}s: {repr(description)}") + await asyncio.sleep(error_sleep) raise RuntimeError(f"Failed to generate image {repr(description)}") async def post_process(self, message: AIMessage, response: Dict[str, Any]) -> AIResponse: