remove x config & merge

my-fix-branch
Shane 7 months ago
parent 5cf367fb40
commit 96cf98c2cf
  1. 6
      foodie_config.py
  2. 1
      foodie_utils.py
  3. 124
      foodie_x_config.py
  4. 2
      foodie_x_poster.py

@ -129,6 +129,7 @@ PERSONA_CONFIGS = {
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. " "Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. " "For article tweets, include the article title, a quirky hook, and the URL. "
"For engagement tweets, ask a question about food trends, foods, or articles to engage the public. " "For engagement tweets, ask a question about food trends, foods, or articles to engage the public. "
"For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text." "Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
) )
}, },
@ -145,6 +146,7 @@ PERSONA_CONFIGS = {
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. " "Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. " "For article tweets, include the article title, a quirky hook, and the URL. "
"For engagement tweets, ask a question about food trends, foods, or articles to engage the public. " "For engagement tweets, ask a question about food trends, foods, or articles to engage the public. "
"For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text." "Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
) )
}, },
@ -161,6 +163,7 @@ PERSONA_CONFIGS = {
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. " "Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. " "For article tweets, include the article title, a quirky hook, and the URL. "
"For engagement tweets, ask a question about food trends, foods, or articles to engage the public. " "For engagement tweets, ask a question about food trends, foods, or articles to engage the public. "
"For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text." "Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
) )
}, },
@ -177,6 +180,7 @@ PERSONA_CONFIGS = {
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. " "Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. " "For article tweets, include the article title, a quirky hook, and the URL. "
"For engagement tweets, ask a question about food trends, foods, or articles to engage the public. " "For engagement tweets, ask a question about food trends, foods, or articles to engage the public. "
"For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text." "Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
) )
}, },
@ -193,6 +197,7 @@ PERSONA_CONFIGS = {
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. " "Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. " "For article tweets, include the article title, a quirky hook, and the URL. "
"For engagement tweets, ask a question about food trends, foods, or articles to engage the public. " "For engagement tweets, ask a question about food trends, foods, or articles to engage the public. "
"For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text." "Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
) )
}, },
@ -209,6 +214,7 @@ PERSONA_CONFIGS = {
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. " "Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. " "For article tweets, include the article title, a quirky hook, and the URL. "
"For engagement tweets, ask a question about food trends, foods, or articles to engage the public. " "For engagement tweets, ask a question about food trends, foods, or articles to engage the public. "
"For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text." "Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
) )
} }

@ -131,7 +131,6 @@ def generate_article_tweet(author, post, persona):
f"Generate a concise tweet (under 280 characters) for {author_handle} using the persona '{persona}'. " f"Generate a concise tweet (under 280 characters) for {author_handle} using the persona '{persona}'. "
f"Summarize the article '{title}' and include the link '{url}'. " f"Summarize the article '{title}' and include the link '{url}'. "
f"Highlight the article's appeal, make it engaging, and encourage interaction. " f"Highlight the article's appeal, make it engaging, and encourage interaction. "
f"Always mention 'InsiderFoodie.com' in the tweet. "
f"Avoid using the word 'elevate'—use more humanized language like 'level up' or 'bring to life'. " f"Avoid using the word 'elevate'—use more humanized language like 'level up' or 'bring to life'. "
f"Do not include hashtags or emojis." f"Do not include hashtags or emojis."
) )

@ -1,124 +0,0 @@
# foodie_x_config.py
from dotenv import load_dotenv
import os
load_dotenv()
X_API_CREDENTIALS = [
{
"username": "owenjohnson",
"x_username": "@insiderfoodieowen",
"api_key": os.getenv("OWENJOHNSON_X_API_KEY"),
"api_secret": os.getenv("OWENJOHNSON_X_API_SECRET"),
"access_token": os.getenv("OWENJOHNSON_X_ACCESS_TOKEN"),
"access_token_secret": os.getenv("OWENJOHNSON_X_ACCESS_TOKEN_SECRET"),
"client_secret": os.getenv("OWENJOHNSON_X_CLIENT_SECRET")
},
{
"username": "javiermorales",
"x_username": "@insiderfoodiejavier",
"api_key": os.getenv("JAVIERMORALES_X_API_KEY"),
"api_secret": os.getenv("JAVIERMORALES_X_API_SECRET"),
"access_token": os.getenv("JAVIERMORALES_X_ACCESS_TOKEN"),
"access_token_secret": os.getenv("JAVIERMORALES_X_ACCESS_TOKEN_SECRET"),
"client_secret": os.getenv("JAVIERMORALES_X_CLIENT_SECRET")
},
{
"username": "aishapatel",
"x_username": "@insiderfoodieaisha",
"api_key": os.getenv("AISHAPATEL_X_API_KEY"),
"api_secret": os.getenv("AISHAPATEL_X_API_SECRET"),
"access_token": os.getenv("AISHAPATEL_X_ACCESS_TOKEN"),
"access_token_secret": os.getenv("AISHAPATEL_X_ACCESS_TOKEN_SECRET"),
"client_secret": os.getenv("AISHAPATEL_X_CLIENT_SECRET")
},
{
"username": "trangnguyen",
"x_username": "@insiderfoodietrang",
"api_key": os.getenv("TRANGNGUYEN_X_API_KEY"),
"api_secret": os.getenv("TRANGNGUYEN_X_API_SECRET"),
"access_token": os.getenv("TRANGNGUYEN_X_ACCESS_TOKEN"),
"access_token_secret": os.getenv("TRANGNGUYEN_X_ACCESS_TOKEN_SECRET"),
"client_secret": os.getenv("TRANGNGUYEN_X_CLIENT_SECRET")
},
{
"username": "keishareid",
"x_username": "@insiderfoodiekeisha",
"api_key": os.getenv("KEISHAREID_X_API_KEY"),
"api_secret": os.getenv("KEISHAREID_X_API_SECRET"),
"access_token": os.getenv("KEISHAREID_X_ACCESS_TOKEN"),
"access_token_secret": os.getenv("KEISHAREID_X_ACCESS_TOKEN_SECRET"),
"client_secret": os.getenv("KEISHAREID_X_CLIENT_SECRET")
},
{
"username": "lilamoreau",
"x_username": "@insiderfoodielila",
"api_key": os.getenv("LILAMOREAU_X_API_KEY"),
"api_secret": os.getenv("LILAMOREAU_X_API_SECRET"),
"access_token": os.getenv("LILAMOREAU_X_ACCESS_TOKEN"),
"access_token_secret": os.getenv("LILAMOREAU_X_ACCESS_TOKEN_SECRET"),
"client_secret": os.getenv("LILAMOREAU_X_CLIENT_SECRET")
}
]
X_PERSONA_PROMPTS = {
"Visionary Editor": {
"description": "a commanding food editor with a borderless view",
"tone": "a polished and insightful tone, like 'This redefines culinary excellence.'",
"prompt": (
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
)
},
"Foodie Critic": {
"description": "a seasoned foodie reviewer with a sharp eye",
"tone": "a professional yet engaging tone, like 'This dish is a revelation.'",
"prompt": (
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
)
},
"Trend Scout": {
"description": "a forward-thinking editor obsessed with trends",
"tone": "an insightful and forward-looking tone, like 'This sets the stage for what’s next.'",
"prompt": (
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
)
},
"Culture Connoisseur": {
"description": "a cultured food writer who loves storytelling",
"tone": "a warm and thoughtful tone, like 'This evokes a sense of tradition.'",
"prompt": (
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
)
},
"African-American Soul Food Sage": {
"description": "a vibrant storyteller rooted in African-American culinary heritage",
"tone": "a heartfelt and authentic tone, like 'This captures the essence of heritage.'",
"prompt": (
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
)
},
"Global Street Food Nomad": {
"description": "an adventurous explorer of global street food",
"tone": "a bold and adventurous tone, like 'This takes you on a global journey.'",
"prompt": (
"Craft a tweet as {description}. Keep it under 280 characters, using {tone}. "
"For article tweets, include the article title, a quirky hook, and the URL. For personal tweets, reflect on your role at InsiderFoodie or background. "
"Avoid emojis and clichés like 'game-changer'. Return only the tweet text."
)
}
}
AUTHOR_BACKGROUNDS_FILE = '/home/shane/foodie_automator/author_backgrounds.json'
X_POST_COUNTS_FILE = '/home/shane/foodie_automator/x_post_counts.json'
RECENT_POSTS_FILE = '/home/shane/foodie_automator/recent_posts.json'

@ -6,7 +6,7 @@ import time
import sys import sys
import signal import signal
import os import os
from datetime import datetime, timezone from datetime import datetime, timezone, timedelta
from openai import OpenAI from openai import OpenAI
from foodie_config import OPENAI_API_KEY, AUTHORS, LIGHT_TASK_MODEL, PERSONA_CONFIGS, AUTHOR_BACKGROUNDS_FILE from foodie_config import OPENAI_API_KEY, AUTHORS, LIGHT_TASK_MODEL, PERSONA_CONFIGS, AUTHOR_BACKGROUNDS_FILE
from foodie_utils import load_json_file, post_tweet from foodie_utils import load_json_file, post_tweet

Loading…
Cancel
Save