mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 05:39: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)
|
conversation = await sync_to_async(ConversationAdapters.get_conversation_by_id)(conversation_id)
|
||||||
|
|
||||||
if not conversation:
|
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
|
yield compiled_references, inferred_queries, defiltered_query
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -548,6 +548,7 @@ async def chat(
|
|||||||
subscribed: bool = has_required_scope(request, ["premium"])
|
subscribed: bool = has_required_scope(request, ["premium"])
|
||||||
event_delimiter = "␃🔚␗"
|
event_delimiter = "␃🔚␗"
|
||||||
q = unquote(q)
|
q = unquote(q)
|
||||||
|
nonlocal conversation_id
|
||||||
|
|
||||||
async def send_event(event_type: ChatEvent, data: str | dict):
|
async def send_event(event_type: ChatEvent, data: str | dict):
|
||||||
nonlocal connection_alive, ttft
|
nonlocal connection_alive, ttft
|
||||||
@@ -615,6 +616,7 @@ async def chat(
|
|||||||
async for result in send_llm_response(f"Conversation {conversation_id} not found"):
|
async for result in send_llm_response(f"Conversation {conversation_id} not found"):
|
||||||
yield result
|
yield result
|
||||||
return
|
return
|
||||||
|
conversation_id = conversation.id
|
||||||
|
|
||||||
await is_ready_to_chat(user)
|
await is_ready_to_chat(user)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user