From 20451b5c2eb25bb83d01d15be4c456361d1b9fc2 Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 30 Apr 2025 21:06:51 +1000 Subject: [PATCH] fix joined paragraph --- foodie_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) 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