@ -137,7 +137,7 @@ def generate_article_tweet(author, post, persona):
author_handle=f"@{author['username']}"
prompt=(
f"Craft a sharp tweet (under 280 characters) for {author_handle} with the voice of '{persona}'. "
f"Craft a sharp tweet (under 230 characters) for {author_handle} with the voice of '{persona}'. "
f"Distill the essence of the article '{title}' and include the raw URL '{url}' at the end. "
f"Make it bold, spark curiosity, and invite engagement with a human touch. "
f"Swap 'elevate' for dynamic terms like 'ignite' or 'unleash'. "
@ -414,53 +414,46 @@ def get_image(search_query):
logging.error(f"Pixabay image fetch failed for query '{search_query}': {e}")
returnNone,None,None,None
defgenerate_image_query(content):
prompt=(
"Given the following content, generate a concise image search query (max 5 words) that would likely yield relevant, visually appealing images on platforms like Flickr or Pixabay. "
"Identify and prioritize specific entities like brand names or unique terms over abstract or generic concepts. "
"Focus on concrete, visual concepts related to food, dining, or restaurants. "
"Also provide relevance keywords (max 5 words) to filter results, using general themes related to the content. "
"Return the result as a JSON object with 'search' and 'relevance' keys.\n\n"
"Content:\n"
f"{content}\n\n"
"Example output:\n"
"```json\n"
"{\n"
"\"search\": \"Wingstop dining\",\n"
"\"relevance\": \"fast food dining\"\n"
"}\n```"
)
defgenerate_image_query(title,summary):
try:
prompt=(
"Given the following article title and summary, generate a concise image search query (max 5 words) to find a relevant image. "
"Also provide a list of relevance keywords (max 5 words) that should be associated with the image. "
"Return the result as a JSON object with 'search' and 'relevance' keys.\n\n"