Fixed bad topic list generation

This commit is contained in:
Roger Gonzalez 2023-05-13 22:37:39 -03:00
parent d8800164cb
commit ccb9d7e504
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6

5
app.py
View File

@ -96,6 +96,11 @@ def get_random_topic() -> str:
)
topics = completion.choices[0].message.content.split(",")
if len(topics) < 5:
logging.info(f"The topics is too short: {topics}. Retrying...")
return get_random_topic()
logging.info(f"The topics list is: {topics}")
topic = random.choice(topics)