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