- FIX: AskDialog compilation error.
- FIX: More Whatsapp line adjustments: Duplicated 'Hi!' & log enrichment.
This commit is contained in:
parent
3cc0b5e7b4
commit
b49d5aafd6
8 changed files with 45 additions and 18 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
# Release History
|
||||||
|
|
||||||
|
## Version 0.0.24
|
||||||
|
|
||||||
|
- FIX: AskDialog compilation error.
|
||||||
|
- FIX: More Whatsapp line adjustments: Duplicated 'Hi!' & log enrichment.
|
||||||
|
|
||||||
## Version 0.0.23
|
## Version 0.0.23
|
||||||
|
|
||||||
- FIX: Duplicated asking on main loop removed.
|
- FIX: Duplicated asking on main loop removed.
|
||||||
|
|
|
@ -56,7 +56,8 @@ export class WelcomeDialog extends IGBDialog {
|
||||||
session.endDialog(msgs);
|
session.endDialog(msgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.message) {
|
|
||||||
|
if (session.message && session.message.text != "") {
|
||||||
session.replaceDialog("/answer", { query: session.message.text });
|
session.replaceDialog("/answer", { query: session.message.text });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,7 @@ export class GBConversationalService implements IGBConversationalService {
|
||||||
logger.trace("error: intent: [" + intent + "] error: [" + error + "]");
|
logger.trace("error: intent: [" + intent + "] error: [" + error + "]");
|
||||||
session.sendTyping();
|
session.sendTyping();
|
||||||
session.send("Desculpe-me, não encontrei nada a respeito...");
|
session.send("Desculpe-me, não encontrei nada a respeito...");
|
||||||
|
session.replaceDialog("/ask", {isReturning: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +118,7 @@ export class GBConversationalService implements IGBConversationalService {
|
||||||
} else {
|
} else {
|
||||||
session.sendTyping();
|
session.sendTyping();
|
||||||
session.send("Lamento, não achei nada a respeito...");
|
session.send("Lamento, não achei nada a respeito...");
|
||||||
|
session.replaceDialog("/ask", {isReturning: true});
|
||||||
cb(null, null);
|
cb(null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ const logger = require("../../../src/logger");
|
||||||
import { Sequelize } from "sequelize-typescript";
|
import { Sequelize } from "sequelize-typescript";
|
||||||
import { Promise } from "bluebird";
|
import { Promise } from "bluebird";
|
||||||
import { GBConfigService } from "./GBConfigService";
|
import { GBConfigService } from "./GBConfigService";
|
||||||
import { DataTypeUUIDv1 } from "sequelize";
|
import { DataTypeUUIDv1 } from "sequelize";
|
||||||
import { UniversalBot } from "botbuilder";
|
import { UniversalBot } from "botbuilder";
|
||||||
import { GBServiceCallback, IGBInstance, IGBCoreService } from 'botlib';
|
import { GBServiceCallback, IGBInstance, IGBCoreService } from 'botlib';
|
||||||
import { GuaribasInstance } from "../models/GBModel";
|
import { GuaribasInstance } from "../models/GBModel";
|
||||||
|
@ -105,13 +105,18 @@ export class GBCoreService implements IGBCoreService {
|
||||||
});
|
});
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
|
|
||||||
syncDatabaseStructure(cb) {
|
syncDatabaseStructure(cb) {
|
||||||
logger.trace("Syncing database...");
|
if (GBConfigService.get("DATABASE_SYNC")) {
|
||||||
this.sequelize.sync().then(value => {
|
logger.trace("Syncing database...");
|
||||||
logger.trace("Database synced.");
|
this.sequelize.sync().then(value => {
|
||||||
cb();
|
logger.trace("Database synced.");
|
||||||
});
|
cb();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
logger.trace("Database synchronization is disabled.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ export class GBMinService {
|
||||||
Authorization: `Bearer ${instance.webchatKey}`
|
Authorization: `Bearer ${instance.webchatKey}`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
request(options).then((response:
|
request(options).then((response:
|
||||||
string) => {
|
string) => {
|
||||||
|
|
||||||
// Serves the bot information object via http so clients can get
|
// Serves the bot information object via http so clients can get
|
||||||
|
@ -246,20 +246,24 @@ export class GBMinService {
|
||||||
},
|
},
|
||||||
receive: function (event: any, next) {
|
receive: function (event: any, next) {
|
||||||
logger.trace(
|
logger.trace(
|
||||||
`Event RCV: (Type: ${event.type}, Name: ${event.name}, Value: ${
|
`[RCV]: ChannelID: ${event.address.channelId}, ConversationID: ${event.address.conversation.id}
|
||||||
event.value
|
Type: ${event.type}, Name: ${event.name}, Text: ${event.text}.`
|
||||||
}).`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// PACKAGE: Provide loop here.
|
// PACKAGE: Provide loop here.
|
||||||
|
|
||||||
if (
|
if (
|
||||||
event.type === "conversationUpdate" &&
|
event.type === "conversationUpdate" &&
|
||||||
event.membersAdded.length > 0 &&
|
event.membersAdded.length > 0
|
||||||
event.membersAdded[0].name != "You"
|
// TODO: Is it really Necessary? !event.membersAdded[0].id.startsWith('general-bot-9672a8d3') //DEMO: min.botId) //TODO: Check entire collection.
|
||||||
) {
|
) {
|
||||||
|
|
||||||
min.bot.beginDialog(event.address, "/");
|
if (event.address.channelId != "directline") {
|
||||||
|
min.bot.beginDialog(event.address, "/");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
} else if (event.name === "whoAmI") {
|
} else if (event.name === "whoAmI") {
|
||||||
min.bot.beginDialog(event.address, "/whoAmI");
|
min.bot.beginDialog(event.address, "/whoAmI");
|
||||||
} else if (event.name === "showSubjects") {
|
} else if (event.name === "showSubjects") {
|
||||||
|
@ -284,6 +288,9 @@ export class GBMinService {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
send: function (event, next) {
|
send: function (event, next) {
|
||||||
|
logger.trace(
|
||||||
|
`[SND]: ChannelID: ${event.address.channelId}, ConversationID: ${event.address.conversation},
|
||||||
|
Type: ${event.type} `);
|
||||||
this.core.createMessage(
|
this.core.createMessage(
|
||||||
this.min.conversation,
|
this.min.conversation,
|
||||||
this.min.conversation.startedBy,
|
this.min.conversation.startedBy,
|
||||||
|
|
|
@ -47,6 +47,7 @@ export class AskDialog extends IGBDialog {
|
||||||
|
|
||||||
bot.dialog("/answer", [
|
bot.dialog("/answer", [
|
||||||
(session, args) => {
|
(session, args) => {
|
||||||
|
|
||||||
let text = "";
|
let text = "";
|
||||||
|
|
||||||
if (args && args.query) {
|
if (args && args.query) {
|
||||||
|
|
|
@ -118,6 +118,7 @@ export class KBService {
|
||||||
|
|
||||||
// Builds search query.
|
// Builds search query.
|
||||||
|
|
||||||
|
what = what.toLowerCase();
|
||||||
what = what.replace("?", " ");
|
what = what.replace("?", " ");
|
||||||
what = what.replace("!", " ");
|
what = what.replace("!", " ");
|
||||||
what = what.replace(".", " ");
|
what = what.replace(".", " ");
|
||||||
|
@ -125,9 +126,12 @@ export class KBService {
|
||||||
what = what.replace("\\", " ");
|
what = what.replace("\\", " ");
|
||||||
|
|
||||||
if (subjects) {
|
if (subjects) {
|
||||||
what = `${what} ${KBService.getSubjectItemsSeparatedBySpaces(
|
let text = KBService.getSubjectItemsSeparatedBySpaces(
|
||||||
subjects
|
subjects
|
||||||
)}`;
|
);
|
||||||
|
if (text){
|
||||||
|
what = `${what} ${text}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Filter by instance. what = `${what}&$filter=instanceId eq ${instanceId}`;
|
// TODO: Filter by instance. what = `${what}&$filter=instanceId eq ${instanceId}`;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "botserver",
|
"name": "botserver",
|
||||||
"version": "0.0.23",
|
"version": "0.0.24",
|
||||||
"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>"
|
||||||
|
|
Loading…
Add table
Reference in a new issue