mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Use nonlocal for conversation_id when running the event_generator
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user