diff --git a/src/khoj/processor/conversation/gpt4all/utils.py b/src/khoj/processor/conversation/gpt4all/utils.py index 25539c02..21f3afb4 100644 --- a/src/khoj/processor/conversation/gpt4all/utils.py +++ b/src/khoj/processor/conversation/gpt4all/utils.py @@ -29,6 +29,12 @@ def download_model(model_name: str): filename = os.path.expanduser(f"~/.cache/gpt4all/{model_name}") if os.path.exists(filename): + # Check if the user is connected to the internet + try: + requests.get("https://www.google.com/", timeout=5) + except: + logger.debug("User is offline. Disabling allowed download flag") + return GPT4All(model_name, allow_download=False) return GPT4All(model_name) # Download the model to a tmp file. Once the download is completed, move the tmp file to the actual file