-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add models and firsts route for connector iadvize * first message fonctional (in loop) * connector iadvize functional * work * fix(bot): empty path redirect on bot.module * fix(nlp): empty path redirect on nlp.module * fix(nlp): empty path redirect on quality.module * fix(nlp): share the getApplications observable between the successive subscriptions * fix(bot): empty path redirect on test.module * fix(bot): share the getConfiguration observable between the successive subscriptions * fix(bot): getConfigurationPending variable typing * add TU * fix(bot): remove deprecated node-sass dependency * fix(nlp): remove deprecated node-sass dependency * corrections suite à relecture * upgrade to 21.9.7-snapshot * correction d'un TU impacté par effet de bord d'une modification de l'engin pour le connecteur iAdvize * Fix errors on dialog closing * add card and quick reply, TU implemented, but not tested * add iAdvize builder * fix commentary * revert: put back master without diff changes (6295e6c and 789fa71) * revert: put back master without diff changes 9d6d692 * remove cli analytics * groupe try catch on iadvize connector * correct commentary * jordan review * explaination * taking acount of review * remove dead code * fix bad response format * add methode to use quick reply with story configured and iadvize * fix bug on echo response by operator role * try to fix 292 but it's already the solution implemeted * correction of commentary * Iadvize tranfer to a human [DERBOT-286] (#100) add transfer to humain on iadvize connector * update version for iadvize * update connector iadvize to be used in bot api mode * tock review Co-authored-by: rkuffer <101799433+rkuffer@users.noreply.github.com> Co-authored-by: djowalker <jordan.monfort@partnre.com> Co-authored-by: SECHET Brandon <brandon.sechet@partnre.com>
- Loading branch information
1 parent
cd7d294
commit d2bfcad
Showing
67 changed files
with
2,379 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (C) 2017/2021 e-voyageurs technologies | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>ai.tock</groupId> | ||
<artifactId>tock-bot</artifactId> | ||
<version>22.3.3-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>tock-bot-connector-iadvize</artifactId> | ||
<name>Tock Bot iAdvize Connector</name> | ||
<description>Bot Connector iAdvize</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>ai.tock</groupId> | ||
<artifactId>tock-bot-engine-jackson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</dependency> | ||
<!-- force jackson dependencies --> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>ai.tock</groupId> | ||
<artifactId>tock-shared</artifactId> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-test-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-params</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.mockk</groupId> | ||
<artifactId>mockk</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.vertx</groupId> | ||
<artifactId>vertx-codegen</artifactId> | ||
<version>${vertx}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
131 changes: 131 additions & 0 deletions
131
bot/connector-iadvize/src/main/kotlin/IadvizeBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
|
||
/* | ||
* Copyright (C) 2017/2022 e-voyageurs technologies | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package ai.tock.bot.connector.iadvize | ||
|
||
import ai.tock.bot.connector.ConnectorType | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.QuickReply | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.payload.TextPayload | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.Duration | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.reply.IadvizeMessage | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.reply.IadvizeMultipartReply | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.reply.IadvizeReply | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.reply.IadvizeTransfer | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.reply.IadvizeAwait | ||
import ai.tock.bot.connector.iadvize.model.response.conversation.reply.IadvizeClose | ||
import ai.tock.bot.engine.Bus | ||
|
||
// Used by bot api, and story script | ||
val millis: Duration.TimeUnit = Duration.TimeUnit.millis | ||
val seconds: Duration.TimeUnit = Duration.TimeUnit.seconds | ||
val minutes: Duration.TimeUnit = Duration.TimeUnit.minutes | ||
|
||
internal const val IADVIZE_CONNECTOR_TYPE_ID = "iadvize" | ||
|
||
/** | ||
* The iAdvize connector type. | ||
*/ | ||
internal val iadvizeConnectorType = ConnectorType(IADVIZE_CONNECTOR_TYPE_ID) | ||
|
||
/** | ||
* Create an iadvize message's provider | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.withIadvize(messageProvider: () -> Any): T { | ||
val iadvizeMessageProvider: () -> IadvizeConnectorMessage = { | ||
val iadvizeReply = messageProvider.invoke() | ||
when(iadvizeReply) { | ||
is IadvizeMultipartReply -> IadvizeConnectorMessage(iadvizeReply) | ||
is IadvizeReply -> IadvizeConnectorMessage(iadvizeReply) | ||
else -> IadvizeConnectorMessage() | ||
} | ||
} | ||
return withMessage(iadvizeConnectorType, iadvizeMessageProvider) | ||
} | ||
|
||
/** | ||
* Creates an iAdvize multipart replies sentence | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeMultipartReplies( | ||
vararg replies : IadvizeReply | ||
): IadvizeMultipartReply = IadvizeMultipartReply(replies.toList()) | ||
|
||
/** | ||
* Creates an iAdvize quickreply sentence | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeQuickReply( | ||
title: CharSequence | ||
): QuickReply = QuickReply(translate(title).toString()) | ||
|
||
/** | ||
* Creates an iAdvize instant transfer | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeTransfer(): IadvizeTransfer = IadvizeTransfer(0) | ||
|
||
/** | ||
* Creates an iAdvize transfer | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeTransfer( | ||
timeoutSeconds: Long | ||
): IadvizeTransfer = IadvizeTransfer(timeoutSeconds) | ||
|
||
/** | ||
* Creates an iAdvize quickreply sentence | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeTransfer( | ||
timeout: Long, | ||
unit: Duration.TimeUnit | ||
): IadvizeTransfer = IadvizeTransfer(Duration(timeout, unit)) | ||
|
||
/** | ||
* Creates an iAdvize message sentence | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeMessage( | ||
title: CharSequence | ||
): IadvizeMessage = IadvizeMessage(translate(title).toString()) | ||
|
||
/** | ||
* Creates an iAdvize message with quickreplies sentence | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeMessage( | ||
title: CharSequence, | ||
vararg quickReplies: QuickReply | ||
): IadvizeMessage = IadvizeMessage(TextPayload(translate(title).toString()), quickReplies.toMutableList()) | ||
|
||
|
||
/** | ||
* Creates an iAdvize await | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeAwait( | ||
timeout: Long, | ||
unit: Duration.TimeUnit | ||
): IadvizeAwait = IadvizeAwait(Duration(timeout, unit)) | ||
|
||
/** | ||
* Creates an iAdvize close dialog | ||
* Used by Story script and bot api (external use) | ||
*/ | ||
fun <T : Bus<T>> T.iadvizeClose( | ||
): IadvizeClose = IadvizeClose() |
Oops, something went wrong.