From 512c0352b3355e46f47b814dc578ba6a99ff8b29 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Sat, 13 May 2023 23:21:17 -0300 Subject: [PATCH] Improved prompt speed and added new topics to the response --- app.py | 8 +++++--- htmls.py | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 7116383..ab0a6ac 100644 --- a/app.py +++ b/app.py @@ -59,7 +59,7 @@ def extract_html_from_chatgpt_response(returned_string: str) -> Union[str, None] validator = HTMLParser(strict=True) try: validator.parse(returned_string) - logging.info("Valid HTML Found") + logging.info(f"Valid HTML Found! {returned_string}") return returned_string except Exception: match = returned_string.split("") @@ -134,9 +134,11 @@ def get_chatgpt_html_response(message: str) -> str: ( f"Give me information about {message}. Now, given this HTML: \n {prompt_html_template} \n replace " "(topic) with the name of the selected topic and (topic_info) with 5 parragraphs talking about the " - "topic. Replace (related_links) with 10 links related to the topic. For these links, the href " + "topic. Replace (related_links) with 5 links related to the topic. For these links, the href " "should be '/infinite?topic=(slugified_related_topic_name)' and the text should be the name of the " - "related topic. The name of these topics should not be more than 5 words. Respond only the code" + "related topic. The name of these topics should not be more than 5 words. Finally, replace " + "(new_topics) with a 5 links with completely new and random topics to talk about. These links " + "should follow the same rules as before. Respond only the code" ) ), ) diff --git a/htmls.py b/htmls.py index 523ba35..1b81dd0 100644 --- a/htmls.py +++ b/htmls.py @@ -34,6 +34,12 @@ prompt_html_template = """ (related_links) +
+

New Topics:

+ +
"""