diff --git a/foodie_utils.py b/foodie_utils.py index 5659eea..5bd354d 100644 --- a/foodie_utils.py +++ b/foodie_utils.py @@ -497,6 +497,12 @@ def summarize_with_gpt4o(content, source_name, link, interest_score=0, extra_pro ) summary = response.choices[0].message.content.strip() + + # Post-processing: Normalize paragraph separation to ensure a single \n break + # Split by any combination of newlines, filter out empty paragraphs, and join with a single \n + paragraphs = [p.strip() for p in summary.split('\n') if p.strip()] + summary = '\n'.join(paragraphs) + logging.info(f"Processed summary (Persona: {persona}): {summary}") return summary