mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 09:48:39 +00:00
fix(ios): gate talk barge-in on isolated audio routes (#18265)
Co-authored-by: Mariano Belinky <mariano@mb-server-643.local>
This commit is contained in:
@@ -1115,6 +1115,7 @@ final class TalkModeManager: NSObject {
|
||||
}
|
||||
|
||||
private func shouldInterrupt(with transcript: String) -> Bool {
|
||||
guard self.shouldAllowSpeechInterruptForCurrentRoute() else { return false }
|
||||
let trimmed = transcript.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard trimmed.count >= 3 else { return false }
|
||||
if let spoken = self.lastSpokenText?.lowercased(), spoken.contains(trimmed.lowercased()) {
|
||||
@@ -1123,6 +1124,20 @@ final class TalkModeManager: NSObject {
|
||||
return true
|
||||
}
|
||||
|
||||
private func shouldAllowSpeechInterruptForCurrentRoute() -> Bool {
|
||||
let route = AVAudioSession.sharedInstance().currentRoute
|
||||
// Built-in speaker/receiver often feeds TTS back into STT, causing false interrupts.
|
||||
// Allow barge-in for isolated outputs (headphones/Bluetooth/USB/CarPlay/AirPlay).
|
||||
return !route.outputs.contains { output in
|
||||
switch output.portType {
|
||||
case .builtInSpeaker, .builtInReceiver:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func shouldUseIncrementalTTS() -> Bool {
|
||||
true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user