mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 09:25:06 +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
|
||||
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
|
||||
def get_text_to_image_model_options():
|
||||
|
@ -914,7 +914,10 @@ class ConversationAdapters:
|
|||
def get_user_text_to_image_model_config(user: KhojUser):
|
||||
config = UserTextToImageModelConfig.objects.filter(user=user).first()
|
||||
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
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in a new issue