TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
durgaprasad rapolu
NA
57
8.8k
Get the data from cloudant database
Apr 2 2019 5:28 AM
Hi everyone..I am creating a chatbot in ibm.cloud.
How to write a nodejs logic when i am chatting with chatbot the responses will come from cloudant database. Here the responses is values. That values are stored in Cloudant database.
I am trying below this code :
function
updateMessage(input, response) {
//var responseText = null;
if
(response.intents && response.intents[0]) {
var
intent = response.intents[0];
if
(intent.intent===
'Sales-1'
){
nano.db.use(
'sample'
);
var
response= {
"selector"
: {
"India"
:
"5,564,546"
}
}
response.output.text=
"This is the modified output:"
+
" "
+
"5,564,546"
;
}
}
return
response;
if
(response.intents && response.intents[0]) {
var
intent = response.intents[0];
// Depending on the confidence of the response the app can return different
// messages.
// The confidence will vary depending on how well the system is trained. The
// service will always try to assign
// a class/intent to the input. If the confidence is low, then it suggests
// the service is unsure of the
// user's intent . In these cases it is usually best to return a
// disambiguation message
// ('I did not understand your intent, please rephrase your question',
// etc..)
if
(intent.confidence >= 0.75) {
responseText =
'I understood your intent was '
+ intent.intent;
}
else
if
(intent.confidence >= 0.5) {
responseText =
'I think your intent was '
+ intent.intent;
}
else
{
responseText =
'I did not understand your intent'
;
}
}
response.output.text = responseText;
return
response;
}
Reply
Answers (
0
)
Regarding ngIf and ngIfElse
How to display the Mysql value out of the function in nodejs