update author oliverwilson

my-fix-branch
Shane 8 months ago
parent f457d67f1d
commit 7dea654e1e
  1. 4
      foodie_config.py
  2. 16
      foodie_utils.py

@ -7,8 +7,8 @@ PIXABAY_API_KEY = "14836528-999c19a033d77d463113b1fb8"
AUTHORS = [ AUTHORS = [
{ {
"url": "https://insiderfoodie.com", "url": "https://insiderfoodie.com",
"username": "shanehill", "username": "oliverwilson",
"password": "LKfH JF0x CnnU SSxK s9f1 993x", "password": "rfjk xhn6 2RPy FuQ9 cGlU K8mC",
"persona": "Visionary Editor", "persona": "Visionary Editor",
"bio": "I oversee worldwide dining shifts, obsessed with the big picture. My edits deliver precise takes—charting the future of food with confidence." "bio": "I oversee worldwide dining shifts, obsessed with the big picture. My edits deliver precise takes—charting the future of food with confidence."
}, },

@ -708,7 +708,7 @@ def post_to_wp(post_data, category, link, author, image_url, original_source, im
content = "Content unavailable. Check the original source for details." content = "Content unavailable. Check the original source for details."
formatted_content = "\n".join(f"<p>{para}</p>" for para in content.split('\n') if para.strip()) formatted_content = "\n".join(f"<p>{para}</p>" for para in content.split('\n') if para.strip())
author_id_map = { author_id_map = {
"shanehill": 5, "oliverwilson": 9,
"javiermorales": 2, "javiermorales": 2,
"aishapatel": 3, "aishapatel": 3,
"liennguyen": 4, "liennguyen": 4,
@ -901,8 +901,8 @@ def select_best_author(summary):
messages=[ messages=[
{"role": "system", "content": ( {"role": "system", "content": (
"Based on this restaurant/food industry trend summary, pick the most suitable author from: " "Based on this restaurant/food industry trend summary, pick the most suitable author from: "
"shanehill, javiermorales, aishapatel, liennguyen, keishawashington, lilamoreau. " "oliverwilson, javiermorales, aishapatel, liennguyen, keishawashington, lilamoreau. "
"Consider their expertise: shanehill (global dining trends), javiermorales (food critique), " "Consider their expertise: oliverwilson (global dining trends), javiermorales (food critique), "
"aishapatel (emerging food trends), liennguyen (cultural dining), keishawashington (soul food heritage), " "aishapatel (emerging food trends), liennguyen (cultural dining), keishawashington (soul food heritage), "
"lilamoreau (global street food). Return only the username." "lilamoreau (global street food). Return only the username."
)}, )},
@ -911,12 +911,12 @@ def select_best_author(summary):
max_tokens=20 max_tokens=20
) )
author = response.choices[0].message.content.strip() author = response.choices[0].message.content.strip()
valid_authors = ["shanehill", "javiermorales", "aishapatel", "liennguyen", "keishawashington", "lilamoreau"] valid_authors = ["oliverwilson", "javiermorales", "aishapatel", "liennguyen", "keishawashington", "lilamoreau"]
logging.info(f"Selected author: {author}") logging.info(f"Selected author: {author}")
return author if author in valid_authors else "shanehill" return author if author in valid_authors else "oliverwilson"
except Exception as e: except Exception as e:
logging.error(f"Author selection failed: {e}") logging.error(f"Author selection failed: {e}")
return "shanehill" return "oliverwilson"
def prepare_post_data(final_summary, original_title, context_info=""): def prepare_post_data(final_summary, original_title, context_info=""):
innovative_title = generate_title_from_summary(final_summary) innovative_title = generate_title_from_summary(final_summary)
@ -948,8 +948,8 @@ def prepare_post_data(final_summary, original_title, context_info=""):
selected_username = select_best_author(final_summary) selected_username = select_best_author(final_summary)
author = next((a for a in AUTHORS if a["username"] == selected_username), None) author = next((a for a in AUTHORS if a["username"] == selected_username), None)
if not author: if not author:
logging.error(f"Author '{selected_username}' not found in AUTHORS, defaulting to shanehill") logging.error(f"Author '{selected_username}' not found in AUTHORS, defaulting to oliverwilson")
author = {"username": "shanehill", "password": "LKfH JF0x CnnU SSxK s9f1 993x"} author = {"username": "oliverwilson", "password": "rfjk xhn6 2RPy FuQ9 cGlU K8mC"}
category = generate_category_from_summary(final_summary) category = generate_category_from_summary(final_summary)
return post_data, author, category, image_url, image_source, uploader, page_url return post_data, author, category, image_url, image_source, uploader, page_url
Loading…
Cancel
Save