diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index 6f44854c..cee238a2 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -716,7 +716,6 @@ async def chat( ## Extract Document References compiled_references: List[Any] = [] inferred_queries: List[Any] = [] - defiltered_query = defilter_query(q) if conversation_commands == [ConversationCommand.Default] or is_automated_task: conversation_commands = await aget_relevant_information_sources( @@ -751,6 +750,8 @@ async def chat( await conversation_command_rate_limiter.update_and_check_if_valid(request, cmd) q = q.replace(f"/{cmd.value}", "").strip() + defiltered_query = defilter_query(q) + if conversation_commands == [ConversationCommand.Research]: async for research_result in execute_information_collection( request=request,