feat: sync TTS voice from server — app reads ttsVoice from /api/v1/me
Voice preference set in web settings now automatically applies in the app. Falls back to "Kore" if no server preference set.
This commit is contained in:
parent
c4884a3748
commit
1645be8a97
2 changed files with 4 additions and 1 deletions
|
|
@ -126,6 +126,7 @@ fun ChatScreen(
|
|||
// TTS playback state
|
||||
var playingTtsForId by remember { mutableStateOf<Long?>(null) }
|
||||
val ttsPlayerRef = remember { mutableStateOf<MediaPlayer?>(null) }
|
||||
var ttsVoice by remember { mutableStateOf("Kore") }
|
||||
|
||||
// Navigation State
|
||||
var currentScreen by remember { mutableStateOf(AppScreen.Chat) }
|
||||
|
|
@ -261,7 +262,7 @@ fun ChatScreen(
|
|||
}
|
||||
ttsPlayerRef.value?.release()
|
||||
playingTtsForId = messageId
|
||||
val voice = "Kore"
|
||||
val voice = ttsVoice
|
||||
scope.launch {
|
||||
val cached = chat.messageDao.getTtsUrl(wireId, voice)
|
||||
if (cached != null) {
|
||||
|
|
@ -297,6 +298,7 @@ fun ChatScreen(
|
|||
KaizenApi.fetchMe(cfg.baseUrl, cfg.token)?.let { me ->
|
||||
me.name?.let { settingsViewModel.updateUserName(it) }
|
||||
me.email?.let { settingsViewModel.updateUserEmail(it) }
|
||||
me.ttsVoice?.let { ttsVoice = it }
|
||||
}
|
||||
chat.conversationRepo.refresh(cfg.baseUrl, cfg.token)
|
||||
if (errors.isNotEmpty()) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.util.concurrent.TimeUnit
|
|||
val name: String? = null,
|
||||
val email: String? = null,
|
||||
val defaultModel: String? = null,
|
||||
val ttsVoice: String? = null,
|
||||
)
|
||||
@Serializable data class WireMessage(val role: String, val content: String)
|
||||
@Serializable private data class ChatRequest(
|
||||
|
|
|
|||
Loading…
Reference in a new issue