From caf0b994e8d49f86a8cf7423bb353e66135c2fdc Mon Sep 17 00:00:00 2001 From: Debanjum Date: Thu, 14 Aug 2025 18:04:08 -0700 Subject: [PATCH] Fix handling failure to select default chat tools Issue: chosen_io variable was accessed before initialization when ValueError was raise. Fix: Set chosen_io to fallback values on failure to select default chat tools --- src/khoj/routers/api_chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index 34956ba1..c647b9a7 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -995,7 +995,7 @@ async def event_generator( ) except ValueError as e: logger.error(f"Error getting data sources and output format: {e}. Falling back to default.") - conversation_commands = [ConversationCommand.General] + chosen_io = {"sources": [ConversationCommand.General], "output": ConversationCommand.Text} conversation_commands = chosen_io.get("sources") + [chosen_io.get("output")]