From c1b37ff579f0d1e0dfd4d9af60db6c4a254398a6 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 1 May 2025 21:14:41 +1000 Subject: [PATCH] remove " from cta --- foodie_hooks.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/foodie_hooks.py b/foodie_hooks.py index 0fa45ba..fb4e763 100644 --- a/foodie_hooks.py +++ b/foodie_hooks.py @@ -28,7 +28,7 @@ def get_dynamic_hook(article_title): except Exception as e: logging.error(f"Dynamic hook generation failed: {e}") return "This food scoop will blow your mind!" - + def get_viral_share_prompt(article_title, content): try: prompt = ( @@ -36,6 +36,7 @@ def get_viral_share_prompt(article_title, content): "Make it bold, quirky, and engaging with a Buzzfeed/Upworthy flair (e.g., 'Obsessed? Share Now'). " "Avoid clichés like 'game-changer' and words like 'elevate'. " "Do not include emojis, the platform name (e.g., Twitter, Facebook), or any HTML. " + "Do not wrap the prompt in quotation marks. " "Return only the prompt text." ) response = client.chat.completions.create( @@ -45,9 +46,11 @@ def get_viral_share_prompt(article_title, content): {"role": "user", "content": f"Title: {article_title}\nContent: {content}"} ], max_tokens=20, - temperature=0.9 # Higher temperature for more creativity + temperature=0.9 ) share_prompt = response.choices[0].message.content.strip() + # Remove any leading or trailing quotation marks + share_prompt = share_prompt.strip('"\'') logging.info(f"Generated viral share prompt: {share_prompt}") return share_prompt except Exception as e: @@ -56,10 +59,8 @@ def get_viral_share_prompt(article_title, content): def select_best_cta(title, content, post_url=None): cta_templates = [ - # Like-focused CTAs "Love This Foodie Find Hit That Like Button", "Think This Dish Is a Game Changer Show Some Love With a Like", - # Follow-focused CTAs "Hungry for More Foodie Insights Follow Us for the Latest Trends", "Dont Miss Out on Foodie Updates Follow Us Today" ]