fix(ptt): dismiss empty overlay immediately on key up

This commit is contained in:
Peter Steinberger
2025-12-09 19:48:28 +01:00
parent 577b0dfe1d
commit 474cb48a14
2 changed files with 11 additions and 1 deletions

View File

@@ -206,6 +206,10 @@ final class GatewayProcessManager: ObservableObject {
}
}
func clearLog() {
self.log = ""
}
private func makeEnvironment() -> Environment {
let merged = CommandResolver.preferredPaths().joined(separator: ":")
return .inherit.updating([

View File

@@ -164,7 +164,13 @@ actor VoicePushToTalk {
self.audioEngine.inputNode.removeTap(onBus: 0)
self.audioEngine.stop()
// Give Speech a brief window to deliver the final result; otherwise fall back to current text.
// If we captured nothing, dismiss immediately when the user lets go.
if self.committed.isEmpty, self.volatile.isEmpty, self.adoptedPrefix.isEmpty {
await self.finalize(transcriptOverride: "", reason: "emptyOnRelease", sessionID: sessionID)
return
}
// Otherwise, give Speech a brief window to deliver the final result; then fall back.
self.timeoutTask?.cancel()
self.timeoutTask = Task { [weak self] in
try? await Task.sleep(nanoseconds: 1_500_000_000) // 1.5s grace period to await final result