fix(tts): add speak() for complete responses; fix briefing message commit race
This commit is contained in:
@@ -148,11 +148,14 @@ watch(selectedConvId, async (id) => {
|
||||
}
|
||||
})
|
||||
|
||||
// Refresh messages after streaming ends
|
||||
// Refresh messages after streaming ends — read from store directly (already updated before streaming=false)
|
||||
watch(() => chatStore.streaming, async (streaming) => {
|
||||
if (!streaming && _mounted && selectedConvId.value === todayConvId.value && todayConvId.value) {
|
||||
const today = await getBriefingToday().catch(() => null)
|
||||
if (_mounted && today) messages.value = today.messages
|
||||
if (!streaming && _mounted && selectedConvId.value === todayConvId.value) {
|
||||
const storeMessages = chatStore.currentConversation?.messages
|
||||
if (_mounted && storeMessages?.length) {
|
||||
messages.value = storeMessages as unknown as BriefingMessage[]
|
||||
}
|
||||
await nextTick()
|
||||
if (_mounted) scrollToBottom()
|
||||
}
|
||||
})
|
||||
@@ -420,7 +423,7 @@ onMounted(async () => {
|
||||
v-if="voiceTtsEnabled"
|
||||
class="btn-icon"
|
||||
:class="{ 'btn-icon-active': listenMode, 'btn-icon-busy': tts.speaking.value }"
|
||||
@click="listenMode = !listenMode; if (!listenMode) tts.stop()"
|
||||
@click="listenMode = !listenMode; if (listenMode) tts.speak([...messages].reverse().find(m => m.role === 'assistant')?.content ?? ''); else tts.stop()"
|
||||
:title="listenMode ? 'Stop auto-read' : 'Read replies aloud'"
|
||||
aria-label="Toggle listen mode"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user