Fix configuration for default voice model settings

This commit is contained in:
sabaimran 2024-08-05 19:57:21 +05:30
parent 998d08f155
commit b17577c138
2 changed files with 4 additions and 2 deletions

View file

@ -752,7 +752,7 @@ class ConversationAdapters:
voice_model_config = await UserVoiceModelConfig.objects.filter(user=user).prefetch_related("setting").afirst() voice_model_config = await UserVoiceModelConfig.objects.filter(user=user).prefetch_related("setting").afirst()
if voice_model_config: if voice_model_config:
return voice_model_config.setting return voice_model_config.setting
return None return await VoiceModelOption.objects.afirst()
@staticmethod @staticmethod
def get_voice_model_options(): def get_voice_model_options():
@ -763,7 +763,7 @@ class ConversationAdapters:
voice_model_config = UserVoiceModelConfig.objects.filter(user=user).prefetch_related("setting").first() voice_model_config = UserVoiceModelConfig.objects.filter(user=user).prefetch_related("setting").first()
if voice_model_config: if voice_model_config:
return voice_model_config.setting return voice_model_config.setting
return None return VoiceModelOption.objects.first()
@staticmethod @staticmethod
def get_default_conversation_config(): def get_default_conversation_config():

View file

@ -27,6 +27,7 @@ from khoj.database.models import (
Subscription, Subscription,
TextToImageModelConfig, TextToImageModelConfig,
UserSearchModelConfig, UserSearchModelConfig,
UserVoiceModelConfig,
VoiceModelOption, VoiceModelOption,
) )
from khoj.utils.helpers import ImageIntentType from khoj.utils.helpers import ImageIntentType
@ -99,6 +100,7 @@ admin.site.register(UserSearchModelConfig)
admin.site.register(ClientApplication) admin.site.register(ClientApplication)
admin.site.register(GithubConfig) admin.site.register(GithubConfig)
admin.site.register(NotionConfig) admin.site.register(NotionConfig)
admin.site.register(UserVoiceModelConfig)
admin.site.register(VoiceModelOption) admin.site.register(VoiceModelOption)