⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
Python aibarkdata-analysisdockerhot-newsllmmailmcpmcp-servernewsntfypythonrsstrending-topicswechatwework
fix(storage): 将同步新闻写入本地读取目录 (#1212)
s4kura865cded5db89
diff --git a/mcp_server/tools/storage_sync.py b/mcp_server/tools/storage_sync.pyindex dd6a73ce9b..ea2485db90 100644--- a/mcp_server/tools/storage_sync.py+++ b/mcp_server/tools/storage_sync.py@@ -280,11 +280,10 @@ class StorageSyncTools:# 拉取单个日期try:- local_date_dir = local_dir / date_str- local_db_path = local_date_dir / "news.db"+ local_db_path = local_dir / "news" / f"{date_str}.db"remote_key = f"news/{date_str}.db"- local_date_dir.mkdir(parents=True, exist_ok=True)+ local_db_path.parent.mkdir(parents=True, exist_ok=True)remote_backend.s3_client.download_file(remote_backend.bucket_name,remote_key,diff --git a/tests/test_storage_sync.py b/tests/test_storage_sync.pynew file mode 100644index 0000000000..adf19bbaa4--- /dev/null+++ b/tests/test_storage_sync.py@@ -0,0 +1,56 @@+from datetime import datetime+from pathlib import Path+from tempfile import TemporaryDirectory+from unittest import TestCase+from unittest.mock import patch++from mcp_server.tools.storage_sync import StorageSyncTools+++class _FakeS3Client:+ def download_file(self, bucket_name, remote_key, local_path):+ Path(local_path).write_bytes(b"database")+++class _FakeRemoteBackend:+ bucket_name = "test-bucket"+ s3_client = _FakeS3Client()++ def __init__(self, available_date):+ self.available_date = available_date++ def list_remote_dates(self):+ return [self.available_date]+++class StorageSyncTests(TestCase):+ def test_sync_downloads_news_database_to_readable_location(self):+ with TemporaryDirectory() as project_root:+ tools = StorageSyncTools(project_root)+ tools._config = {+ "app": {"timezone": "Asia/Shanghai"},+ "storage": {+ "local": {"data_dir": "output"},+ "remote": {+ "endpoint_url": "https://example.invalid",+ "bucket_name": "test-bucket",+ "access_key_id": "test-key",+ "secret_access_key": "test-secret",+ },+ },+ }+ today = "2026-09-05"+ tools._remote_backend = _FakeRemoteBackend(today)++ with patch(+ "trendradar.utils.time.get_configured_time",+ return_value=datetime(2026, 9, 5),+ ):+ result = tools.sync_from_remote(days=1)++ self.assertTrue(result["success"])+ self.assertEqual(result["data"]["synced_dates"], [today])+ self.assertEqual(tools._get_local_dates(), [today])+ self.assertTrue(+ (Path(project_root) / "output" / "news" / f"{today}.db").is_file()+ )