Better placement for the recursion catcher

This commit is contained in:
Roger Gonzalez 2023-09-18 18:54:23 -03:00
parent f1fd170cbd
commit 555ccfb8d1
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6

View File

@ -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: