fix: cmd_generate usa _active_sessions para la sesión correcta
Build & Deploy ResearchOwl / build-and-push (push) Successful in 6s
Build & Deploy ResearchOwl / build-and-push (push) Successful in 6s
Si hay una sesión activa registrada para el chat, se consulta directamente por id en lugar de por created_at DESC, evitando que /generate use la sesión más reciente en vez de la actual. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+13
-6
@@ -305,12 +305,19 @@ async def cmd_generate(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
|
|||||||
db = ResearchDB(db_conn)
|
db = ResearchDB(db_conn)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Find last session for this chat
|
# Usa la sesión activa si existe, si no la más reciente
|
||||||
cursor = await db_conn.execute(
|
session_id = _active_sessions.get(chat_id)
|
||||||
"""SELECT * FROM research_sessions WHERE telegram_chat_id = ?
|
if session_id:
|
||||||
ORDER BY created_at DESC LIMIT 1""",
|
cursor = await db_conn.execute(
|
||||||
(chat_id,)
|
"SELECT * FROM research_sessions WHERE id = ?",
|
||||||
)
|
(session_id,)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
cursor = await db_conn.execute(
|
||||||
|
"""SELECT * FROM research_sessions WHERE telegram_chat_id = ?
|
||||||
|
ORDER BY created_at DESC LIMIT 1""",
|
||||||
|
(chat_id,)
|
||||||
|
)
|
||||||
row = await cursor.fetchone()
|
row = await cursor.fetchone()
|
||||||
if not row:
|
if not row:
|
||||||
await update.message.reply_text("No research sessions found. Start with /research <topic>")
|
await update.message.reply_text("No research sessions found. Start with /research <topic>")
|
||||||
|
|||||||
Reference in New Issue
Block a user