feat(voice): support per-client conversation mode state

This commit is contained in:
Shantur
2026-03-31 12:39:29 +01:00
parent 197dee2aea
commit 42589464e5
9 changed files with 409 additions and 14 deletions

View File

@@ -4,6 +4,7 @@ import { showToastNotification } from "../lib/notifications"
import { serverApi } from "../lib/api-client"
import { getLogger } from "../lib/logger"
import { formatToMimeType, getSpeechPlaybackSupport } from "../lib/speech-playback-support"
import { serverEvents } from "../lib/server-events"
import { serverSettings } from "./preferences"
import { loadSpeechCapabilities, speechCapabilities } from "./speech"
import { getActiveSession, sessions } from "./session-state"
@@ -44,6 +45,10 @@ let currentPlayback:
let queueRunner: Promise<void> | null = null
let playbackErrorShown = false
serverEvents.onOpen(() => {
void syncConversationModesToServer()
})
function getEntryKey(instanceId: string, sessionId: string, messageId: string, partId: string): string {
return `${instanceId}:${sessionId}:${messageId}:${partId}`
}
@@ -532,3 +537,12 @@ function extractLeadingSpokenBlock(text: string): string {
if (!match?.[1]) return ""
return match[1].trim()
}
async function syncConversationModesToServer(): Promise<void> {
const updates: Promise<unknown>[] = []
for (const [instanceId, enabled] of conversationModeInstances()) {
if (!enabled) continue
updates.push(serverApi.updateVoiceMode(instanceId, true))
}
await Promise.allSettled(updates)
}