Simplify logic to get default search model. Remove unused import

This commit is contained in:
Debanjum 2024-11-01 15:14:00 -07:00
parent 2b35790165
commit ac21b10dd5
2 changed files with 2 additions and 5 deletions

View file

@ -476,11 +476,9 @@ def get_default_search_model() -> SearchModelConfig:
if default_search_model: if default_search_model:
return default_search_model return default_search_model
elif SearchModelConfig.objects.count() > 0: elif SearchModelConfig.objects.count() == 0:
return SearchModelConfig.objects.first()
else:
SearchModelConfig.objects.create() SearchModelConfig.objects.create()
return SearchModelConfig.objects.filter(name="default").first() return SearchModelConfig.objects.first()
def get_user_default_search_model(user: KhojUser = None) -> SearchModelConfig: def get_user_default_search_model(user: KhojUser = None) -> SearchModelConfig:

View file

@ -1,5 +1,4 @@
import logging import logging
import os
import random import random
from threading import Thread from threading import Thread