feat(news): research 时讯加可信过滤、去重与国内配额

候选池按独立事件拉取,白名单过滤低质源,同事件与 tech 主题去重后按展示上限打包。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-31 15:47:50 +08:00
parent 0384e2c7a9
commit e2f609a027
6 changed files with 848 additions and 23 deletions

View File

@@ -5,7 +5,24 @@ from __future__ import annotations
import unittest
from daily.format_wecom import _ai_news_lines, replace_wecom_news_sections
from daily.news.research import parse_research_response
from daily.news.research import (
parse_research_response,
research_pool_limit,
research_tech_pool_limit,
)
class TestAiNewsResearchPool(unittest.TestCase):
def test_pool_defaults_above_display(self):
self.assertEqual(research_pool_limit(10), 20)
self.assertEqual(research_tech_pool_limit(5), 10)
def test_pool_env_override(self):
import os
from unittest import mock
with mock.patch.dict(os.environ, {"DAILY_AI_NEWS_RESEARCH_POOL": "24"}, clear=False):
self.assertEqual(research_pool_limit(10), 24)
class TestAiNewsResearchParse(unittest.TestCase):