From d18d742ff4fcacc9f2c82b0eb137173d4c1276ab Mon Sep 17 00:00:00 2001 From: jayce1116 Date: Mon, 18 Mar 2024 09:45:58 +0900 Subject: [PATCH] update ASR Interface --- .../ASRAgent+Event.swift | 21 +++++++++++++------ .../AutomaticSpeechRecognition/ASRAgent.swift | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/NuguAgents/Sources/CapabilityAgents/AutomaticSpeechRecognition/ASRAgent+Event.swift b/NuguAgents/Sources/CapabilityAgents/AutomaticSpeechRecognition/ASRAgent+Event.swift index 98e2a90df..46a158fba 100644 --- a/NuguAgents/Sources/CapabilityAgents/AutomaticSpeechRecognition/ASRAgent+Event.swift +++ b/NuguAgents/Sources/CapabilityAgents/AutomaticSpeechRecognition/ASRAgent+Event.swift @@ -52,7 +52,7 @@ extension ASRAgent.Event: Eventable { var payload: [String: AnyHashable] { var payload: [String: AnyHashable?] switch typeInfo { - case .recognize(let initiator, let options, let service): + case let .recognize(initiator, options, service): payload = [ "codec": "SPEEX", "language": "KOR", @@ -62,14 +62,23 @@ extension ASRAgent.Event: Eventable { "domainTypes": dialogAttributes?["domainTypes"], "asrContext": dialogAttributes?["asrContext"], "service": service, - "timeout": [ - "listen": options.timeout.truncatedMilliSeconds, - "maxSpeech": options.maxDuration.truncatedMilliSeconds, - "response": 10000 - ], "requestType": options.requestType ] + if options.endPointing == .client { + payload["epd"] = [ + "timeoutMilliseconds": options.timeout.truncatedMilliSeconds, + "silenceIntervalInMilliseconds": options.pauseLength.truncatedMilliSeconds, + "maxSpeechDurationMilliseconds": options.maxDuration.truncatedMilliSeconds, + ] + } else { + payload["timeout"] = [ + "listen": options.timeout.truncatedMilliSeconds, + "maxSpeech": options.maxDuration.truncatedMilliSeconds, + "response": 10000 // default value + ] + } + if case let .wakeUpWord(keyword, _, start, end, detection) = initiator { var wakeup: [String: AnyHashable?] = ["word": keyword] if options.endPointing == .server { diff --git a/NuguAgents/Sources/CapabilityAgents/AutomaticSpeechRecognition/ASRAgent.swift b/NuguAgents/Sources/CapabilityAgents/AutomaticSpeechRecognition/ASRAgent.swift index 0dce37256..35711a0c1 100644 --- a/NuguAgents/Sources/CapabilityAgents/AutomaticSpeechRecognition/ASRAgent.swift +++ b/NuguAgents/Sources/CapabilityAgents/AutomaticSpeechRecognition/ASRAgent.swift @@ -29,7 +29,7 @@ import RxSwift public final class ASRAgent: ASRAgentProtocol { // CapabilityAgentable - public var capabilityAgentProperty: CapabilityAgentProperty = CapabilityAgentProperty(category: .automaticSpeechRecognition, version: "1.8") + public var capabilityAgentProperty: CapabilityAgentProperty = CapabilityAgentProperty(category: .automaticSpeechRecognition, version: "1.9") private let playSyncProperty = PlaySyncProperty(layerType: .asr, contextType: .sound) public weak var delegate: ASRAgentDelegate?