fix(stage-layouts): clear voice auto-send input before ingest resolves (#1510)

Co-authored-by-agent: Cursor
This commit is contained in:
Lulu
2026-03-30 03:36:42 +08:00
committed by GitHub
parent 58401c8b6d
commit 5a11ff7b25
@@ -95,18 +95,22 @@ async function debouncedAutoSend(text: string) {
const textToSend = pendingAutoSendText.value.trim()
if (textToSend && autoSendEnabled.value) {
try {
// `ingest()` resolves only after the full assistant turn finishes; clear UI/buffer now so
// the next SentenceEnd during streaming does not append to the message we already committed.
messageInput.value = ''
pendingAutoSendText.value = ''
const providerConfig = providersStore.getProviderConfig(activeProvider.value)
await ingest(textToSend, {
chatProvider: await providersStore.getProviderInstance(activeProvider.value) as ChatProvider,
model: activeModel.value,
providerConfig,
})
// Clear the message input after sending
messageInput.value = ''
pendingAutoSendText.value = ''
}
catch (err) {
console.error('[ChatArea] Auto-send error:', err)
// Preserve any transcription that arrived while ingest was in flight (see PR review).
messageInput.value = [textToSend, messageInput.value.trim()].filter(Boolean).join(' ')
pendingAutoSendText.value = [textToSend, pendingAutoSendText.value.trim()].filter(Boolean).join(' ')
}
}
autoSendTimeout = undefined