Fix pilot voice composer flow and typing issues

This commit is contained in:
Ruslan Bakiev
2026-02-19 14:32:45 +07:00
parent 2aa565fe74
commit da23741b08

View File

@@ -852,8 +852,10 @@ async function startPilotMeter(stream: MediaStream) {
function appendPilotTranscript(text: string) { function appendPilotTranscript(text: string) {
const next = text.trim(); const next = text.trim();
if (!next) return; if (!next) return "";
pilotInput.value = pilotInput.value.trim() ? `${pilotInput.value.trim()} ${next}` : next; const merged = pilotInput.value.trim() ? `${pilotInput.value.trim()} ${next}` : next;
pilotInput.value = merged;
return merged;
} }
function getAudioContextCtor(): typeof AudioContext { function getAudioContextCtor(): typeof AudioContext {
@@ -1003,11 +1005,11 @@ async function startPilotRecording() {
if (audioBlob.size > 0) { if (audioBlob.size > 0) {
const transcript = await transcribeRecordedPilotAudio(audioBlob); const transcript = await transcribeRecordedPilotAudio(audioBlob);
if (!transcript) return; if (!transcript) return;
if (mode === "send" && !pilotSending.value) { const mergedText = appendPilotTranscript(transcript);
await sendPilotText(transcript); if (mode === "send" && !pilotSending.value && mergedText.trim()) {
await sendPilotText(mergedText);
return; return;
} }
appendPilotTranscript(transcript);
} }
}; };
@@ -2551,7 +2553,6 @@ async function decideFeedCard(card: FeedCard, decision: "accepted" | "rejected")
v-model="pilotInput" v-model="pilotInput"
class="pilot-input-textarea" class="pilot-input-textarea"
:placeholder="pilotRecording ? 'Recording... speak, then press mic to fill or send to submit' : 'Type a message for Pilot...'" :placeholder="pilotRecording ? 'Recording... speak, then press mic to fill or send to submit' : 'Type a message for Pilot...'"
:disabled="pilotTranscribing"
@keydown.enter="handlePilotComposerEnter" @keydown.enter="handlePilotComposerEnter"
/> />