Refactor AI daily report pipeline

This commit is contained in:
Mimikko-zeus
2026-06-04 15:21:56 +08:00
parent 94e18ce22d
commit 5a98696255
64 changed files with 4778 additions and 1316 deletions

View File

@@ -0,0 +1,39 @@
import unittest
from ai_daily_report.assemble import assemble_markdown
from ai_daily_report.models import NewsItem
class MarkdownRenderingTests(unittest.TestCase):
def test_blog_markdown_strips_double_blockquote_and_reference_markers(self):
items = [
NewsItem(
id="a",
source_group="AI HOT",
source_label="OpenAIBlog",
source_role="primary",
source_priority=10,
title_raw="测试模型发布",
title_norm="测试模型发布",
summary_raw="测试摘要",
title="测试模型发布",
summary="测试摘要",
url="https://openai.com/blog/test",
canonical_url="https://openai.com/blog/test",
section="模型与能力",
)
]
guide = {"theme": "> 主线判断:测试主线[1]", "threads": []}
md, _ = assemble_markdown(items, guide)
self.assertIn("## 导览", md)
self.assertIn("## 模型与能力", md)
self.assertIn("[OpenAIBlog ↗](https://openai.com/blog/test)", md)
self.assertNotIn("> >", md)
self.assertNotIn("[1]", md)
self.assertNotIn("主线判断", md)
if __name__ == "__main__":
unittest.main()