Improved prompt speed and added new topics to the response
This commit is contained in:
parent
55bcb6d41f
commit
512c0352b3
8
app.py
8
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("<html>")
|
||||
@ -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"
|
||||
)
|
||||
),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user