diff --git a/chatgpt_helper.py b/chatgpt_helper.py index db965bf..395239f 100644 --- a/chatgpt_helper.py +++ b/chatgpt_helper.py @@ -147,14 +147,14 @@ async def get_chatgpt_html_response(topic: str = None, count: int = 0) -> str: """ count += 1 + if count >= 5: + return f"Error! ChatGPT is having problems with this topic: {topic}. Try a new one." + if topic is None: topic = await get_random_topic() html = prompt_html_template.replace("(topic)", topic) - if count >= 5: - return f"Error! ChatGPT is having problems with this topic: {topic}. Try a new one." - logging.info(f"The topic to generate is {topic}") try: