From 7976aa30f852c1d7ce6ac6f8ab8e348d4868663b Mon Sep 17 00:00:00 2001 From: Debanjum Date: Mon, 24 Mar 2025 19:38:45 +0530 Subject: [PATCH] Terminate research if query or tool is empty --- src/khoj/routers/research.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/khoj/routers/research.py b/src/khoj/routers/research.py index 6e2493c5..330d669e 100644 --- a/src/khoj/routers/research.py +++ b/src/khoj/routers/research.py @@ -233,6 +233,10 @@ async def execute_information_collection( if this_iteration.warning: logger.warning(f"Research mode: {this_iteration.warning}.") + # Terminate research if query, tool not set for next iteration + elif not this_iteration.query or not this_iteration.tool: + current_iteration = MAX_ITERATIONS + elif this_iteration.tool == ConversationCommand.Notes: this_iteration.context = [] document_results = []