mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 19:03:01 +01:00
Fix retrieving image model by prefetching the openai config in the async method
This commit is contained in:
parent
a129b017b9
commit
d61bddf56c
1 changed files with 5 additions and 2 deletions
|
@ -904,7 +904,7 @@ class ConversationAdapters:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def aget_text_to_image_model_config():
|
async def aget_text_to_image_model_config():
|
||||||
return await TextToImageModelConfig.objects.filter().afirst()
|
return await TextToImageModelConfig.objects.filter().prefetch_related("openai_config").afirst()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_text_to_image_model_options():
|
def get_text_to_image_model_options():
|
||||||
|
@ -914,7 +914,10 @@ class ConversationAdapters:
|
||||||
def get_user_text_to_image_model_config(user: KhojUser):
|
def get_user_text_to_image_model_config(user: KhojUser):
|
||||||
config = UserTextToImageModelConfig.objects.filter(user=user).first()
|
config = UserTextToImageModelConfig.objects.filter(user=user).first()
|
||||||
if not config:
|
if not config:
|
||||||
return None
|
default_config = ConversationAdapters.get_text_to_image_model_config()
|
||||||
|
if not default_config:
|
||||||
|
return None
|
||||||
|
return default_config
|
||||||
return config.setting
|
return config.setting
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue