update personas to add Tone

This commit is contained in:
2025-04-28 18:30:09 +10:00
parent 1f1c5012c7
commit a1d2ce4215
5 changed files with 166 additions and 75 deletions
+15 -2
View File
@@ -1,3 +1,4 @@
# foodie_x_poster.py
import json
import logging
import random
@@ -93,7 +94,13 @@ def delete_used_post(post_title):
logging.info(f"Deleted post '{post_title}' from recent_posts.json")
def generate_article_tweet(author, post, persona):
prompt = X_PERSONA_PROMPTS[persona].replace(
# Format the prompt using description and tone
persona_config = X_PERSONA_PROMPTS[persona]
base_prompt = persona_config["prompt"].format(
description=persona_config["description"],
tone=persona_config["tone"]
)
prompt = base_prompt.replace(
"For article tweets, include the article title, a quirky hook, and the URL.",
f"Generate an article tweet including the title '{post['title']}', a quirky hook, and the URL '{post['url']}'."
)
@@ -138,7 +145,13 @@ def generate_personal_tweet(author, persona):
f"Early memory: {background['early_memory']}, Career path: {background['career_path']}."
)
prompt = X_PERSONA_PROMPTS[persona].replace(
# Format the prompt using description and tone
persona_config = X_PERSONA_PROMPTS[persona]
base_prompt = persona_config["prompt"].format(
description=persona_config["description"],
tone=persona_config["tone"]
)
prompt = base_prompt.replace(
"For personal tweets, reflect on your role at InsiderFoodie or background.",
content
)