Fix image generation on server -- use default config when not set by user

This commit is contained in:
sabaimran 2024-07-04 09:13:23 +05:30
parent 6fa2dbc042
commit a129b017b9

View file

@ -918,10 +918,13 @@ class ConversationAdapters:
return config.setting
@staticmethod
async def aget_user_text_to_image_model(user: KhojUser):
async def aget_user_text_to_image_model(user: KhojUser) -> Optional[TextToImageModelConfig]:
config = await UserTextToImageModelConfig.objects.filter(user=user).prefetch_related("setting").afirst()
if not config:
return None
default_config = await ConversationAdapters.aget_text_to_image_model_config()
if not default_config:
return None
return default_config
return config.setting
@staticmethod