Commit 9e4a00cc authored by Eric Meier's avatar Eric Meier

works now with in memory db

parent d86e7df1
......@@ -24,15 +24,6 @@ let connector = new builder.ChatConnector({
// Listen for messages from users
server.post("/api/messages", connector.listen());
let tableName = "botdata";
let azureTableClient = new botbuilder_azure.AzureTableClient(
tableName,
process.env["AzureWebJobsStorage"]
);
let tableStorage = new botbuilder_azure.AzureBotStorage(
{ gzipData: false },
azureTableClient
);
let bot = new builder.UniversalBot(connector);
server.post("/api/messages", connector.listen());
......@@ -42,7 +33,7 @@ server.post("/api/messages", connector.listen());
// Make sure you add code to validate these fields
const luisAppId = "e7fcc4d6-8558-431e-a697-5e96e57e8c2d";
const luisAPIKey = "8c724fa2d88943a9abe55c557e8ff743";
const luisAPIKey = "db7d02f854ec409c9380c3c821c93123";
const luisAPIHostName =
process.env.LuisAPIHostName || "westus.api.cognitive.microsoft.com";
......
var request = require("sync-request");
//const HOST = "https://evil-octopus-34.localtunnel.me/";
const HOST = "https://suggestions32435342.localtunnel.me/";
const HOST = "https://plastic-cheetah-98.localtunnel.me/";
var querySuggestions = (keyword, read_time, difficulty) => {
var url = `${HOST}suggestions?keyword=${normalize(
......@@ -9,15 +9,14 @@ var querySuggestions = (keyword, read_time, difficulty) => {
)}&difficulty=${normalize(difficulty)}&read_time=${normalize(read_time)}`;
data = fetchJsonSync(url);
console.log(data);
//Normalize data
if (data)
data = data
.map(s => {
return {
title: s.name[0],
url: s.url[0],
keywords: s.keywords,
title: s.title,
url: s.url,
topic: keyword
};
})
......@@ -32,7 +31,6 @@ var normalize = s => {
};
var fetchJsonSync = url => {
console.log(url);
let res = request("GET", url);
try {
......
......@@ -10,13 +10,29 @@ module.exports = [
builder.Prompts.choice(session, reply, choices);
},
(session, results) => {
(session, results, next) => {
if (results.response.entity === "Bye Bye") {
session.userData = {};
session.replaceDialog("welcome");
} else {
session.endDialog();
}
setTimeout(() => next(), 3000);
},
(session, results, next) => {
session.send("I can learn the way you want me to be!");
setTimeout(() => next(), 7000);
},
(session, results, next) => {
session.send("Please come back :(");
setTimeout(() => next(), 10000);
},
(session, results, next) => {
session.send("Come back ! The cake is a lie!");
setTimeout(() => next(), 600000);
},
(session, results, next) => {
session.replaceDialog("welcome");
}
];
......
......@@ -13,7 +13,6 @@ module.exports = [
} else {
if (
store.getRecentTopics(6, session.userData) &&
typeof store.getRecentTopics(6, session.userData) == Array &&
store.getRecentTopics(6, session.userData).length >= 0
)
session.replaceDialog("recent");
......@@ -39,7 +38,7 @@ module.exports = [
);
session.userData.name = results.response;
session.send("What do you wanna learn about tody?");
session.send(answers.formatedRandomAnswer("intro", []));
session.endDialog();
}
];
......
......@@ -4,9 +4,6 @@
},
"delete_account": {
"confirm": [
"**Do you really want to leave me, [0]?**",
"**Are you 100% sure you want to delete your account ?**",
"**I will miss you! Are you sure you want to continue?**",
"**I will change, things can go back to the way they were... Do you really want to leave me now?**"
]
},
......@@ -74,5 +71,5 @@
"I'm really sorry, but I cant remember me about our last topic."
]
},
"intro": [""]
"intro": ["What do you wanna learn about today?"]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment