From ac21b10dd5143fb3d7f3f9af0b77ba5462adb0bd Mon Sep 17 00:00:00 2001 From: Debanjum Date: Fri, 1 Nov 2024 15:14:00 -0700 Subject: [PATCH] Simplify logic to get default search model. Remove unused import --- src/khoj/database/adapters/__init__.py | 6 ++---- src/khoj/processor/conversation/google/utils.py | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/khoj/database/adapters/__init__.py b/src/khoj/database/adapters/__init__.py index d8d8e644..afcaa9f0 100644 --- a/src/khoj/database/adapters/__init__.py +++ b/src/khoj/database/adapters/__init__.py @@ -476,11 +476,9 @@ def get_default_search_model() -> SearchModelConfig: if default_search_model: return default_search_model - elif SearchModelConfig.objects.count() > 0: - return SearchModelConfig.objects.first() - else: + elif SearchModelConfig.objects.count() == 0: SearchModelConfig.objects.create() - return SearchModelConfig.objects.filter(name="default").first() + return SearchModelConfig.objects.first() def get_user_default_search_model(user: KhojUser = None) -> SearchModelConfig: diff --git a/src/khoj/processor/conversation/google/utils.py b/src/khoj/processor/conversation/google/utils.py index ccde33d1..7b848324 100644 --- a/src/khoj/processor/conversation/google/utils.py +++ b/src/khoj/processor/conversation/google/utils.py @@ -1,5 +1,4 @@ import logging -import os import random from threading import Thread