From 1f7109b924446128aaa4b4293fa882ef92556690 Mon Sep 17 00:00:00 2001 From: "n.voloshin" Date: Fri, 1 Dec 2023 11:32:46 +0300 Subject: [PATCH 1/5] Bump version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index ae7880dd..0abea347 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.just-ai.jaicf" - version = "1.3.2-SNAPSHOT" + version = "1.3.3" repositories { mavenCentral() From d61130506d70352251abe15b99b168a30a266d47 Mon Sep 17 00:00:00 2001 From: Tagir Fayzullin Date: Mon, 22 Jan 2024 14:47:17 +0300 Subject: [PATCH 2/5] add: tts param to telephony reactions say --- .../jaicp/reactions/TelephonyReactions.kt | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt b/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt index 3c017a8c..61f29b35 100755 --- a/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt +++ b/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt @@ -38,10 +38,14 @@ class TelephonyReactions(private val bargeInDefaultProps: BargeInProperties) : J * * @param text to synthesis speech from * @param bargeIn true to allow interruption and handle in in current dialog context + * @param tts true to allow SSML parsing of text * */ - fun say(text: String, bargeIn: Boolean) = when (bargeIn) { - true -> say(text, CURRENT_CONTEXT_PATH) - false -> say(text) + fun say(text: String, bargeIn: Boolean, tts: Boolean = false) = when (bargeIn) { + true -> say(text, CURRENT_CONTEXT_PATH, tts) + false -> if (tts) { + replies.add(TextReply(text, state = currentState, tts = text)) + SayReaction.create(text) + } else say(text) } /** @@ -50,10 +54,18 @@ class TelephonyReactions(private val bargeInDefaultProps: BargeInProperties) : J * * @param text to synthesis speech from speech from * @param bargeInContext scenario context with states which should handle possible interruptions. + * @param tts true to allow SSML parsing of text * */ - fun say(text: String, @PathValue bargeInContext: String): SayReaction { + fun say(text: String, @PathValue bargeInContext: String, tts: Boolean): SayReaction { ensureBargeInProps() - replies.add(TextReply(text, state = currentState, bargeInReply = BargeInReplyData(bargeInContext, BargeInType.INTENT))) + replies.add( + TextReply( + text, + state = currentState, + bargeInReply = BargeInReplyData(bargeInContext, BargeInType.INTENT), + tts = if (tts) text else null + ) + ) return SayReaction.create(text) } From fd56eda1e549207a2b263bae808cf573512f6cd3 Mon Sep 17 00:00:00 2001 From: Tagir Fayzullin Date: Mon, 22 Jan 2024 15:23:12 +0300 Subject: [PATCH 3/5] fix: convert tts param to string --- .../channel/jaicp/reactions/TelephonyReactions.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt b/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt index 61f29b35..7d091719 100755 --- a/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt +++ b/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt @@ -38,12 +38,12 @@ class TelephonyReactions(private val bargeInDefaultProps: BargeInProperties) : J * * @param text to synthesis speech from * @param bargeIn true to allow interruption and handle in in current dialog context - * @param tts true to allow SSML parsing of text + * @param tts SSML text for telephony channel * */ - fun say(text: String, bargeIn: Boolean, tts: Boolean = false) = when (bargeIn) { + fun say(text: String, bargeIn: Boolean, tts: String? = null) = when (bargeIn) { true -> say(text, CURRENT_CONTEXT_PATH, tts) - false -> if (tts) { - replies.add(TextReply(text, state = currentState, tts = text)) + false -> if (tts != null) { + replies.add(TextReply(text, state = currentState, tts = tts)) SayReaction.create(text) } else say(text) } @@ -54,16 +54,16 @@ class TelephonyReactions(private val bargeInDefaultProps: BargeInProperties) : J * * @param text to synthesis speech from speech from * @param bargeInContext scenario context with states which should handle possible interruptions. - * @param tts true to allow SSML parsing of text + * @param tts SSML text for telephony channel * */ - fun say(text: String, @PathValue bargeInContext: String, tts: Boolean): SayReaction { + fun say(text: String, @PathValue bargeInContext: String, tts: String? = null): SayReaction { ensureBargeInProps() replies.add( TextReply( text, state = currentState, bargeInReply = BargeInReplyData(bargeInContext, BargeInType.INTENT), - tts = if (tts) text else null + tts = tts ) ) return SayReaction.create(text) From 546361946cc39a9f0da59b15c8f215980b0e42bc Mon Sep 17 00:00:00 2001 From: Tagir Fayzullin Date: Wed, 24 Jan 2024 13:21:20 +0300 Subject: [PATCH 4/5] fix: move tts param logic to another method --- .../channel/jaicp/reactions/TelephonyReactions.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt b/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt index 7d091719..276bda16 100755 --- a/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt +++ b/channels/jaicp/src/main/kotlin/com/justai/jaicf/channel/jaicp/reactions/TelephonyReactions.kt @@ -42,7 +42,18 @@ class TelephonyReactions(private val bargeInDefaultProps: BargeInProperties) : J * */ fun say(text: String, bargeIn: Boolean, tts: String? = null) = when (bargeIn) { true -> say(text, CURRENT_CONTEXT_PATH, tts) - false -> if (tts != null) { + false -> say(text, tts) + } + + /** + * Sends text to synthesis in telephony channel. + * Allows to interrupt synthesis only by phrases which we can handle in scenario. + * + * @param text to synthesis speech from text + * @param tts SSML text for telephony channel + * */ + fun say(text: String, tts: String? = null): SayReaction { + return if (tts != null) { replies.add(TextReply(text, state = currentState, tts = tts)) SayReaction.create(text) } else say(text) From 683e8f8f62fe3bc007cd6218ace65a74c7aaf6c7 Mon Sep 17 00:00:00 2001 From: Tagir Fayzullin Date: Thu, 25 Jan 2024 14:58:37 +0300 Subject: [PATCH 5/5] bump version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0abea347..c6084f07 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.just-ai.jaicf" - version = "1.3.3" + version = "1.3.4" repositories { mavenCentral()