From 33a5efaf4beea6401d7f3d3ae14625c6ae86d910 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Tue, 10 Dec 2024 19:50:31 -0800 Subject: [PATCH] Fix undefined variable exception during openai provider setup on init Resolves #1001 --- src/khoj/utils/initialization.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/khoj/utils/initialization.py b/src/khoj/utils/initialization.py index 4dd46e5b..91c6ce1a 100644 --- a/src/khoj/utils/initialization.py +++ b/src/khoj/utils/initialization.py @@ -56,8 +56,10 @@ def initialization(interactive: bool = True): valid_default_models = [model for model in default_openai_chat_models if model in default_chat_models] other_available_models = [model for model in default_chat_models if model not in valid_default_models] default_chat_models = valid_default_models + other_available_models - except Exception: - logger.warning(f"⚠️ Failed to fetch {provider} chat models. Fallback to default models. Error: {e}") + except Exception as e: + logger.warning( + f"⚠️ Failed to fetch {provider} chat models. Fallback to default models. Error: {str(e)}" + ) # Set up OpenAI's online chat models openai_configured, openai_provider = _setup_chat_model_provider(