diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-09-17 16:07:06 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-09-17 16:07:06 -0700 |
| commit | a3f00e15f7c1657891787be0b21813c2f4aeaca9 (patch) | |
| tree | f028dbdaed656b48f7de64ee94590cdfd86f825f /news_feed.py | |
| parent | 74fb827a4b24625d07a7e234dba59d844ba2b155 (diff) | |
add default entries and handle summarization API errors
Diffstat (limited to 'news_feed.py')
| -rw-r--r-- | news_feed.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/news_feed.py b/news_feed.py index 3c158d9..2131676 100644 --- a/news_feed.py +++ b/news_feed.py @@ -43,11 +43,18 @@ import constants import translate import summarizer +from datetime import datetime + def _attach_llm_summaries(news_posts: list, game_name: str): for post in news_posts: image_urls = [img["image"] for img in post.get("images", []) if "image" in img] if image_urls: headline, content = summarizer.generate_headline_and_content_from_images(image_urls, game_name) + if headline is None and content is None: + datetime_str = datetime.now().strftime("%H:%M:%S") + post["headline"] = f"{game_name} Update" + post["content"] = f"573-UPDATES has found a news post for {game_name} at {datetime_str}, please refer to the image for more details!" + post["is_ai_summary"] = False post["headline"] = headline post["content"] = content post["is_ai_summary"] = True |
