- FIX: Duplicated asking on main loop removed.

- FIX: Whatsapp log phrase correction.
- FIX: Directline can now receive messages sent in not-in-conversation, projector-only fashion.
This commit is contained in:
Rodrigo Rodriguez 2018-05-16 12:06:37 -03:00
parent b7b62c0642
commit 040977076f
6 changed files with 46 additions and 47 deletions

View file

@ -1,7 +1,20 @@
## Version 0.0.23
- FIX: Duplicated asking on main loop removed.
- FIX: Whatsapp log phrase correction.
- FIX: Directline can now receive messages sent in not-in-conversation, projector-only fashion.
## Version 0.0.22
- NEW: Auto-dispatch to dialog based on intent name.
## Version 0.0.21
- FIX: Whatsapp directline client improved.
## Version 0.0.20 ## Version 0.0.20
- NEW: Whatsapp directline client is now working in preview. - NEW: Whatsapp directline client is now working in preview.
- NEW: Auto-dispatch to dialog based on intent name.
## Version 0.0.19 ## Version 0.0.19

View file

@ -63,10 +63,6 @@ export class AskDialog extends IGBDialog {
if (text === "") { if (text === "") {
session.replaceDialog("/ask"); session.replaceDialog("/ask");
} else if (AzureText.isIntentNo(text)) {
session.replaceDialog("/feedback");
} else if (AzureText.isIntentYes(text)) {
session.replaceDialog("/menu");
} else { } else {
AzureText.getSpelledText( AzureText.getSpelledText(
min.instance.spellcheckerKey, min.instance.spellcheckerKey,
@ -138,8 +134,7 @@ export class AskDialog extends IGBDialog {
text, text,
(data, error) => { (data, error) => {
if (!data) if (!data) {
{
let msgs = [ let msgs = [
"Desculpe-me, não encontrei nada a respeito.", "Desculpe-me, não encontrei nada a respeito.",
"Lamento... Não encontrei nada sobre isso. Vamos tentar novamente?", "Lamento... Não encontrei nada sobre isso. Vamos tentar novamente?",
@ -167,13 +162,6 @@ export class AskDialog extends IGBDialog {
.dialog("/ask", [ .dialog("/ask", [
(session, args) => { (session, args) => {
session.userData.isAsking = true; session.userData.isAsking = true;
let text = [
`Pergunte-me sobre qualquer assunto ou digite **menu** para conhecer uma lista de opções.`,
`Pode perguntar sobre qualquer assunto... Ou digita **menu** para conhecer uma lista de opções.`,
`Faça qualquer pergunta ou também posso te mostrar o **menu** de assuntos sempre que precisar...`
];
if (session.userData.subjects.length > 0) { if (session.userData.subjects.length > 0) {
text = [ text = [
`Faça sua pergunta...`, `Faça sua pergunta...`,
@ -189,8 +177,9 @@ export class AskDialog extends IGBDialog {
"Deseja fazer outra pergunta?" "Deseja fazer outra pergunta?"
]; ];
} }
if (text.length > 0) {
Prompts.text(session, text); Prompts.text(session, text);
}
}, },
(session, results) => { (session, results) => {
session.replaceDialog("/answer", { query: results.response }); session.replaceDialog("/answer", { query: results.response });

View file

@ -180,10 +180,7 @@ export class MenuDialog extends IGBDialog {
session.replaceDialog("/ask"); session.replaceDialog("/ask");
} }
} }
]) ]);
.triggerAction({
matches: /^(menu)/i
});
bot.beginDialogAction("menuAction", "/menu"); bot.beginDialogAction("menuAction", "/menu");
} }

View file

@ -452,7 +452,7 @@ export class KBService {
playerType: "video", playerType: "video",
data: answer.content data: answer.content
}); });
} else if (answer.content.length > 140) { } else if (answer.content.length > 140 && session.message.source != "directline") {
let msgs = [ let msgs = [
"Vou te responder na tela para melhor visualização...", "Vou te responder na tela para melhor visualização...",
"A resposta está na tela...", "A resposta está na tela...",

View file

@ -89,7 +89,8 @@ export class WhatsappDirectLine extends GBService {
qs: qs:
{ {
token: this.whatsappServiceKey, token: this.whatsappServiceKey,
webhookUrl: `${this.whatsappServiceWebhookUrl}/instances/${this.botId}/whatsapp` webhookUrl: `${this.whatsappServiceWebhookUrl}/instances/${this.botId}/whatsapp`,
set: true
}, },
headers: headers:
{ {
@ -101,7 +102,7 @@ export class WhatsappDirectLine extends GBService {
const result = await request.post(options); const result = await request.post(options);
logger.info(result); logger.info(result);
} catch (error) { } catch (error) {
logger.error('Error initializing DirectLine client', error); logger.error('Error initializing 3rd party Whatsapp provider.', error);
} }
return client; return client;
@ -177,7 +178,6 @@ export class WhatsappDirectLine extends GBService {
} }
pollMessages(client, conversationId, from, fromName) { pollMessages(client, conversationId, from, fromName) {
logger.info(`GBWhatsapp: Starting polling message for conversationId: logger.info(`GBWhatsapp: Starting polling message for conversationId:
@ -203,8 +203,8 @@ export class WhatsappDirectLine extends GBService {
if (activities && activities.length) { if (activities && activities.length) {
// Ignore own messages. // Ignore own messages.
// TODO: this.botId instead of "general-bot-9672a8d3"
activities = activities.filter((m) => { return m.from.id === this.botId && m.type === "message" }); activities = activities.filter((m) => { return m.from.id === "general-bot-9672a8d3" && m.type === "message" });
if (activities.length) { if (activities.length) {

View file

@ -1,6 +1,6 @@
{ {
"name": "botserver", "name": "botserver",
"version": "0.0.21", "version": "0.0.23",
"description": "General Bot Community Edition open-core server.", "description": "General Bot Community Edition open-core server.",
"contributors": [ "contributors": [
"Rodrigo Rodriguez <me@rodrigorodriguez.com>" "Rodrigo Rodriguez <me@rodrigorodriguez.com>"
@ -30,34 +30,34 @@
}, },
"dependencies": { "dependencies": {
"@types/azure": "^0.9.19", "@types/azure": "^0.9.19",
"@types/chai": "4.0.4", "@types/chai": "4.1.3",
"@types/mocha": "2.2.43", "@types/mocha": "5.2.0",
"@types/url-join": "^0.8.2", "@types/url-join": "^0.8.2",
"async": "^1.5.2", "async": "^2.6.0",
"body-parser": "^1.18.2", "body-parser": "^1.18.2",
"botbuilder": "^3.14.0", "botbuilder": "^3.15.0",
"botlib": "0.0.19", "botlib": "0.0.23",
"chai": "^4.1.2", "chai": "^4.1.2",
"chokidar": "^2.0.2", "chokidar": "^2.0.2",
"csv-parse": "^2.4.0", "csv-parse": "^2.4.0",
"dotenv-extended": "^1.0.4", "dotenv-extended": "^2.0.2",
"express": "^4.16.2", "express": "^4.16.2",
"fs-extra": "^5.0.0", "fs-extra": "^6.0.1",
"fs-walk": "0.0.1", "fs-walk": "0.0.2",
"marked": "^0.3.12", "marked": "^0.3.12",
"mocha": "^3.5.3", "mocha": "^5.1.1",
"mocha-typescript": "^1.1.12", "mocha-typescript": "^1.1.12",
"pragmatismo-io-framework": "^1.0.11", "pragmatismo-io-framework": "^1.0.12",
"reflect-metadata": "^0.1.12", "reflect-metadata": "^0.1.12",
"request-promise-native": "^1.0.5", "request-promise-native": "^1.0.5",
"sequelize": "^4.37.6", "sequelize": "^4.37.6",
"sequelize-typescript": "^0.6.3", "sequelize-typescript": "^0.6.3",
"sqlite3": "^4.0.0", "sqlite3": "^4.0.0",
"swagger-client": "^2.1.18", "swagger-client": "^3.8.3",
"tedious": "^2.1.1", "tedious": "^2.1.1",
"ts-node": "3.3.0", "ts-node": "6.0.3",
"typedoc": "^0.10.0", "typedoc": "^0.11.1",
"typescript": "2.7.2", "typescript": "2.8.3",
"url-join": "^4.0.0", "url-join": "^4.0.0",
"wait-until": "0.0.2", "wait-until": "0.0.2",
"winston": "^2.4.0" "winston": "^2.4.0"