update categories to add Buzz

main
Shane 7 months ago
parent 37f9fdcc44
commit 692811190e
  1. 3
      foodie_config.py
  2. 6
      foodie_utils.py

@ -248,8 +248,7 @@ HOME_KEYWORDS = ["home", "house", "household", "appliance", "kitchen", "gadget"]
PRODUCT_KEYWORDS = ["best", "buy", "storage", "organizer", "shop", "price", "container", "product", "deal", "sale", "discount"] PRODUCT_KEYWORDS = ["best", "buy", "storage", "organizer", "shop", "price", "container", "product", "deal", "sale", "discount"]
CATEGORIES = [ CATEGORIES = [
"People", "Trends", "Travel", "Buzz", "Trends", "Lifestyle", "Culture", "Health", "Drink", "Food", "Eats"
"Lifestyle", "Buzz", "Culture", "Health", "Drink", "Food", "Eats"
] ]
REDDIT_CLIENT_ID = os.getenv("REDDIT_CLIENT_ID") REDDIT_CLIENT_ID = os.getenv("REDDIT_CLIENT_ID")

@ -663,7 +663,7 @@ def generate_category_from_summary(summary):
model=LIGHT_TASK_MODEL, model=LIGHT_TASK_MODEL,
messages=[ messages=[
{"role": "system", "content": ( {"role": "system", "content": (
"Based on this summary, select the most relevant category from: Food, Culture, Trends, Health, Lifestyle, Drink, Eats. " "Based on this summary, select the most relevant category from: Buzz, Trends, Lifestyle, Culture, Health, Drink, Food, Eats. "
"Return only the category name." "Return only the category name."
)}, )},
{"role": "user", "content": summary} {"role": "user", "content": summary}
@ -672,7 +672,7 @@ def generate_category_from_summary(summary):
) )
category = response.choices[0].message.content.strip() category = response.choices[0].message.content.strip()
logging.info(f"Generated category: {category}") logging.info(f"Generated category: {category}")
return category if category in ["Food", "Culture", "Trends", "Health", "Lifestyle", "Drink", "Eats"] else "Trends" return category if category in ["Buzz", "Trends", "Lifestyle", "Culture", "Health", "Drink", "Food", "Eats"] else "Trends"
except Exception as e: except Exception as e:
logging.error(f"Category generation failed: {e}") logging.error(f"Category generation failed: {e}")
return "Trends" return "Trends"
@ -1637,7 +1637,7 @@ def prepare_post_data(summary, title, main_topic=None):
# Select a full author dictionary from AUTHORS (already imported from foodie_config) # Select a full author dictionary from AUTHORS (already imported from foodie_config)
author = random.choice(AUTHORS) author = random.choice(AUTHORS)
categories = ["Food", "Trends", "Eats", "Culture"] categories = ["Buzz", "Trends", "Lifestyle", "Culture", "Health", "Drink", "Food", "Eats"]
category = random.choice(categories) category = random.choice(categories)
post_data = { post_data = {

Loading…
Cancel
Save