Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion MiniflowApp/MiniflowApp/ViewModels/AgentViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ final class AgentViewModel: ObservableObject {
guard isListening else { return }
isListening = false
keyReleaseTime = Date()
audio.onChunk = nil

if let start = listeningStartTime, let release = keyReleaseTime {
lastAudioLengthSecs = release.timeIntervalSince(start)
}

// Keep capturing briefly after key release so the last word isn't clipped
try? await Task.sleep(nanoseconds: 150_000_000)
audio.onChunk = nil
audio.stopCapture()

do {
Expand Down