feat: modo diff para /watch — notifica solo si hay novedades reales
Build & Deploy ResearchOwl / build-and-push (push) Successful in 7s

This commit is contained in:
ChemaVX
2026-05-05 07:43:41 +00:00
parent f4e167f3b6
commit 53cf7a04a8
3 changed files with 142 additions and 6 deletions
+21
View File
@@ -159,6 +159,27 @@ class ResearchDB:
row = await cursor.fetchone()
return dict(row) if row else None
async def get_session_urls(self, session_id: int) -> set:
async with self.db.execute(
"SELECT url FROM sources WHERE session_id = ?", (session_id,)
) as cur:
rows = await cur.fetchall()
return {r[0] for r in rows}
async def get_previous_session(self, chat_id: int, topic: str,
exclude_session_id: int) -> Optional[dict]:
async with self.db.execute(
"""SELECT id, topic, status, created_at FROM research_sessions
WHERE telegram_chat_id = ? AND topic = ? AND id != ?
ORDER BY created_at DESC LIMIT 1""",
(chat_id, topic, exclude_session_id)
) as cur:
row = await cur.fetchone()
if not row:
return None
return {"id": row[0], "topic": row[1],
"status": row[2], "created_at": row[3]}
async def get_active_session(self, chat_id: int) -> Optional[dict]:
cursor = await self.db.execute(
"""SELECT * FROM research_sessions