This commit is contained in:
1 parent
120ab192f1
commit
63e15b6023
5 files changed
+83
-10
No files matched your search
+11
-3
@@ -166,9 +166,16 @@ function updateModeUI() {
|
||||
|
||||
async function setConversationMode(mode) {
|
||||
if (mode !== "voice" && mode !== "text") return;
|
||||
const previousMode = conversationMode;
|
||||
conversationMode = mode;
|
||||
localStorage.setItem(MODE_KEY, mode);
|
||||
updateModeUI();
|
||||
if (mode === "voice" && previousMode === "text") {
|
||||
chatInput.blur();
|
||||
window.setTimeout(() => {
|
||||
document.querySelector(".workspace").scrollIntoView({ block: "start", behavior: "smooth" });
|
||||
}, 0);
|
||||
}
|
||||
|
||||
if (!room || !room.localParticipant) return;
|
||||
sendModeMessage(mode);
|
||||
@@ -314,9 +321,10 @@ function inferState() {
|
||||
userSpeaking = micLevel > 0.035;
|
||||
if (agentAudioLevel > 0.02) return "speaking";
|
||||
if (userSpeaking) return "listening";
|
||||
// Not speaking, agent silent: stay in thinking until audio arrives,
|
||||
// otherwise settle back to listening.
|
||||
if (uiState === "thinking" || uiState === "speaking") return "thinking";
|
||||
// Once agent audio ends, return to listening. The previous implementation
|
||||
// converted speaking → thinking forever, leaving the UI apparently frozen.
|
||||
if (uiState === "speaking") return "listening";
|
||||
if (uiState === "thinking") return "thinking";
|
||||
return "listening";
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user