Artur Mukhamadiev 9c8e4c7345 [tg] stats/search features
Processed data is not written back to user
2026-03-13 12:50:49 +03:00

37 lines
1.3 KiB
Python

from typing import List
from src.crawlers.base import ICrawler
from src.processor.base import ILLMProvider
from src.storage.base import IVectorStore
from src.notifications.base import INotificationService
class TrendScoutService:
def __init__(
self,
crawlers: List[ICrawler],
processor: ILLMProvider,
storage: IVectorStore,
notifier: INotificationService,
):
self.crawlers = crawlers
self.processor = processor
self.storage = storage
self.notifier = notifier
async def run_iteration(self) -> None:
for crawler in self.crawlers:
items = await crawler.fetch_latest()
for item in items:
if await self.storage.exists(item.url):
continue
enriched_item = await self.processor.analyze(item)
if enriched_item.relevance_score < 5:
enriched_item.content_text = ""
await self.storage.store(enriched_item)
# Proactive alerts are currently disabled per user request
# if enriched_item.relevance_score >= 8 or bool(enriched_item.anomalies_detected):
# await self.notifier.send_alert(enriched_item)