diff --git a/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/ConfigConstants.kt b/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/ConfigConstants.kt index 2783db1..e2647cc 100644 --- a/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/ConfigConstants.kt +++ b/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/ConfigConstants.kt @@ -46,14 +46,20 @@ object ConfigConstants { ) } - val llmProviders = NamedOptionList(listOf(Anthropic, Together), default = Together) - - val ttsProviders = NamedOptionList(listOf(Cartesia)) - val botProfiles = NamedOptionList( listOf( - "Voice only" isProfile "voice_2024_08", - "Voice and vision" isProfile "vision_2024_08" + BotProfile( + name = "Voice only", + id = "voice_2024_08", + llmProviders = NamedOptionList(listOf(Anthropic, Together), default = Together), + ttsProviders = NamedOptionList(listOf(Cartesia)) + ), + BotProfile( + name = "Voice and vision", + id = "vision_2024_08", + llmProviders = NamedOptionList(listOf(Anthropic)), + ttsProviders = NamedOptionList(listOf(Cartesia)) + ), ) ) } @@ -87,6 +93,8 @@ interface LLMProvider : NamedOption { data class BotProfile( override val name: String, override val id: String, + val llmProviders: NamedOptionList, + val ttsProviders: NamedOptionList, ) : NamedOption data class LLMOptionModel( @@ -100,5 +108,4 @@ data class TTSOptionVoice( ) : NamedOption private infix fun String.isModel(id: String) = LLMOptionModel(name = this, id = id) -private infix fun String.isVoice(id: String) = TTSOptionVoice(name = this, id = id) -private infix fun String.isProfile(id: String) = BotProfile(name = this, id = id) \ No newline at end of file +private infix fun String.isVoice(id: String) = TTSOptionVoice(name = this, id = id) \ No newline at end of file diff --git a/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/Preferences.kt b/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/Preferences.kt index e4d17c1..2da7281 100644 --- a/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/Preferences.kt +++ b/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/Preferences.kt @@ -97,11 +97,16 @@ data class LastInitOptions( ) } - fun inflateInit() = VoiceClientManager.InitOptions( - botProfile = ConfigConstants.botProfiles.byIdOrDefault(botProfile), - ttsProvider = ConfigConstants.ttsProviders.byIdOrDefault(ttsProvider), - llmProvider = ConfigConstants.llmProviders.byIdOrDefault(llmProvider), - ) + fun inflateInit(): VoiceClientManager.InitOptions { + + val botProfile = ConfigConstants.botProfiles.byIdOrDefault(botProfile) + + return VoiceClientManager.InitOptions( + botProfile = botProfile, + ttsProvider = botProfile.ttsProviders.byIdOrDefault(ttsProvider), + llmProvider = botProfile.llmProviders.byIdOrDefault(llmProvider), + ) + } fun inflateRuntime(initOptions: VoiceClientManager.InitOptions) = VoiceClientManager.RuntimeOptions( ttsVoice = initOptions.ttsProvider.voices.byIdOrDefault(ttsVoice), diff --git a/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/VoiceClientManager.kt b/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/VoiceClientManager.kt index 2c37d5e..59d3cc7 100644 --- a/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/VoiceClientManager.kt +++ b/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/VoiceClientManager.kt @@ -43,11 +43,13 @@ class VoiceClientManager(private val context: Context) { val llmProvider: LLMProvider, ) { companion object { - fun default() = InitOptions( - botProfile = ConfigConstants.botProfiles.default, - ttsProvider = ConfigConstants.ttsProviders.default, - llmProvider = ConfigConstants.llmProviders.default, - ) + fun default() = ConfigConstants.botProfiles.default.let { botProfile -> + InitOptions( + botProfile = botProfile, + ttsProvider = botProfile.ttsProviders.default, + llmProvider = botProfile.llmProviders.default, + ) + } } } @@ -57,10 +59,12 @@ class VoiceClientManager(private val context: Context) { val llmModel: LLMOptionModel, ) { companion object { - fun default() = RuntimeOptions( - ttsVoice = ConfigConstants.ttsProviders.default.voices.default, - llmModel = ConfigConstants.llmProviders.default.models.default, - ) + fun default() = ConfigConstants.botProfiles.default.let { botProfile -> + RuntimeOptions( + ttsVoice = botProfile.ttsProviders.default.voices.default, + llmModel = botProfile.llmProviders.default.models.default, + ) + } } } diff --git a/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/ui/VoiceClientSettingsPanel.kt b/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/ui/VoiceClientSettingsPanel.kt index b621f50..17c697b 100644 --- a/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/ui/VoiceClientSettingsPanel.kt +++ b/rtvi-basic-demo/src/main/java/ai/rtvi/client/basicdemo/ui/VoiceClientSettingsPanel.kt @@ -56,6 +56,8 @@ fun VoiceClientSettingsPanel( .verticalScroll(scrollState) .padding(horizontal = 20.dp) ) { + Header("Bot Configuration") + RadioGroup( label = "Bot Profile", onSelect = { updatePref { copy(botProfile = it.id) } }, @@ -69,7 +71,7 @@ fun VoiceClientSettingsPanel( label = "Service", onSelect = { updatePref { copy(ttsProvider = it.id) } }, selected = initOptions.ttsProvider, - options = ConfigConstants.ttsProviders, + options = initOptions.botProfile.ttsProviders, ) RadioGroup( @@ -85,7 +87,7 @@ fun VoiceClientSettingsPanel( label = "Service", onSelect = { updatePref { copy(llmProvider = it.id) } }, selected = initOptions.llmProvider, - options = ConfigConstants.llmProviders + options = initOptions.botProfile.llmProviders ) RadioGroup( @@ -102,7 +104,7 @@ fun VoiceClientSettingsPanel( @Composable private fun ColumnScope.Header(text: String) { - Spacer(Modifier.height(30.dp)) + Spacer(Modifier.height(42.dp)) Text( text = text, @@ -119,7 +121,7 @@ private fun ColumnScope.RadioGroup( selected: E, options: NamedOptionList, ) { - Spacer(Modifier.height(20.dp)) + Spacer(Modifier.height(26.dp)) Text( text = label,