diff --git a/src/khoj/routers/api.py b/src/khoj/routers/api.py index 5fc79bcd..40c65ce2 100644 --- a/src/khoj/routers/api.py +++ b/src/khoj/routers/api.py @@ -358,7 +358,7 @@ async def extract_references_and_questions( conversation = await sync_to_async(ConversationAdapters.get_conversation_by_id)(conversation_id) if not conversation: - logger.error(f"Conversation with id {conversation_id} not found.") + logger.error(f"Conversation with id {conversation_id} not found when extracting references.") yield compiled_references, inferred_queries, defiltered_query return diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index 39c1e48b..7fb48347 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -548,6 +548,7 @@ async def chat( subscribed: bool = has_required_scope(request, ["premium"]) event_delimiter = "␃🔚␗" q = unquote(q) + nonlocal conversation_id async def send_event(event_type: ChatEvent, data: str | dict): nonlocal connection_alive, ttft @@ -615,6 +616,7 @@ async def chat( async for result in send_llm_response(f"Conversation {conversation_id} not found"): yield result return + conversation_id = conversation.id await is_ready_to_chat(user)