fix joined paragraph
This commit is contained in:
@@ -497,6 +497,12 @@ def summarize_with_gpt4o(content, source_name, link, interest_score=0, extra_pro
|
|||||||
)
|
)
|
||||||
|
|
||||||
summary = response.choices[0].message.content.strip()
|
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}")
|
logging.info(f"Processed summary (Persona: {persona}): {summary}")
|
||||||
return summary
|
return summary
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user