From 0f3927e810ae178e662092dcd76389209f65310e Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sat, 26 Oct 2024 05:59:10 -0700 Subject: [PATCH] Send gathered references to client after code results calculated --- src/khoj/routers/api_chat.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index e80d215f..d0b78d9a 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -973,18 +973,6 @@ async def chat( ): yield result - ## Send Gathered References - async for result in send_event( - ChatEvent.REFERENCES, - { - "inferredQueries": inferred_queries, - "context": compiled_references, - "onlineContext": online_results, - "codeContext": code_results, - }, - ): - yield result - if pending_research: ## Gather Code Results if ConversationCommand.Code in conversation_commands and pending_research: @@ -1015,6 +1003,18 @@ async def chat( exc_info=True, ) + ## Send Gathered References + async for result in send_event( + ChatEvent.REFERENCES, + { + "inferredQueries": inferred_queries, + "context": compiled_references, + "onlineContext": online_results, + "codeContext": code_results, + }, + ): + yield result + # Generate Output ## Generate Image Output if ConversationCommand.Image in conversation_commands: