mirror of
https://github.com/BoPeng/ai-marketplace-monitor.git
synced 2025-12-23 22:28:18 -05:00
Fix newline spacing around AI messages in notifications (#236)
Add proper newline spacing before "AI:" messages in all notification formats: - Plain text: Add \n before "AI:" - Markdown: Add \n before "**AI**:" - HTML: Add <br> before "<b>AI</b>:" - Email text: Add \n before "AI:" This improves readability by separating AI comments from listing details with appropriate whitespace in all notification channels.
This commit is contained in:
@@ -119,7 +119,7 @@ class EmailNotificationConfig(NotificationConfig):
|
||||
return ""
|
||||
|
||||
title += " ".join(cnts)
|
||||
title += f"{listings[0].name} {p.plural_noun('listing', len(listings)-(0 if force else n_notified))} from {listings[0].marketplace}"
|
||||
title += f"{listings[0].name} {p.plural_noun('listing', len(listings) - (0 if force else n_notified))} from {listings[0].marketplace}"
|
||||
return title
|
||||
|
||||
def get_text_message(
|
||||
@@ -155,7 +155,7 @@ class EmailNotificationConfig(NotificationConfig):
|
||||
f"{prefix} [{rating.conclusion} ({rating.score})] {listing.title}\n"
|
||||
f"{listing.price}, {listing.location}\n"
|
||||
f"{listing.post_url.split('?')[0]}\n"
|
||||
f"AI: {rating.comment}"
|
||||
f"\nAI: {rating.comment}"
|
||||
)
|
||||
)
|
||||
message = "\n\n".join(messages)
|
||||
|
||||
@@ -186,7 +186,7 @@ class PushNotificationConfig(NotificationConfig):
|
||||
f"[{rating.conclusion} ({rating.score})] {listing.title}\n"
|
||||
f"{listing.price}, {listing.location}\n"
|
||||
f"{listing.post_url.split('?')[0]}\n{desc}{desc_newline}"
|
||||
f"AI: {rating.comment}"
|
||||
f"\nAI: {rating.comment}"
|
||||
)
|
||||
)
|
||||
elif self.message_format == "markdown":
|
||||
@@ -203,23 +203,23 @@ class PushNotificationConfig(NotificationConfig):
|
||||
f"[**{listing.title}**]({listing.post_url.split('?')[0]})\n"
|
||||
f"{listing.price}, {listing.location}\n"
|
||||
f"{desc}{desc_newline}"
|
||||
f"**AI**: {rating.comment}"
|
||||
f"\n**AI**: {rating.comment}"
|
||||
)
|
||||
)
|
||||
elif self.message_format == "html":
|
||||
desc_newline = "<br>" if desc else ""
|
||||
msg = (
|
||||
(
|
||||
f"""<a href="{listing.post_url.split('?')[0]}"><b>{listing.title}</b></a>"""
|
||||
f"""<a href="{listing.post_url.split("?")[0]}"><b>{listing.title}</b></a>"""
|
||||
f"<br>{listing.price}, {listing.location}{desc_newline}{desc}"
|
||||
)
|
||||
if rating.comment == AIResponse.NOT_EVALUATED
|
||||
else (
|
||||
f"<b>[{rating.conclusion} ({rating.score})]</b>"
|
||||
f"""<a href="{listing.post_url.split('?')[0]}"><b>{listing.title}</b></a>"""
|
||||
f"""<a href="{listing.post_url.split("?")[0]}"><b>{listing.title}</b></a>"""
|
||||
f"<br>{listing.price}, {listing.location}<br>"
|
||||
f"{desc}{desc_newline}"
|
||||
f"<b>AI</b>: <i>{rating.comment}</i>"
|
||||
f"<br><b>AI</b>: <i>{rating.comment}</i>"
|
||||
)
|
||||
)
|
||||
msgs[ns].append((listing, msg))
|
||||
|
||||
Reference in New Issue
Block a user