如果我设置在沃森的对话上下文对象的方式工作,我希望它保持它以前访问过的节点我的意思是:语境在沃森的谈话是不是在它应该工作
在发出问候意图后,如果我输入'再见'(再见意图)。它应该激发一个再见的意图,但它只是在测试工具中工作。
这里是我的应用程序的NodeJS代码:
let context = {}
const conversation = new ConversationV1({
username: 'myUsername',
password: 'myPassword',
url: 'https://gateway.watsonplatform.net/conversation/api',
version_date: '2017-05-26'
})
conversation.message({ workspace_id: workspaceId}, function (err, response) {
if (err) {
console.log(err)
} else {
context = response.context
}
})
sendMessage = (message = null) => new Promise((resolve, reject) => {
conversation.message({
input: {text: message},
workspace_id: workspaceId,
context: context
}, function (err, response) {
if (err) {
reject(err)
} else {
resolve(response.output.text)
}
})
}
虽然conversation_id始终是相同的。我总是得到anythingelse的Intent响应 ,而不是告别的意图。
{ intents: [ { intent: 'greetings', confidence: 1 } ],
entities: [],
input: { text: 'hi' },
output:
{ text: [ 'It is nice to talk to you, again !' ],
nodes_visited: [ 'greetings' ],
log_messages: [] },
context:
{ conversation_id: '7cc96494-d108-4dc9-95c4-63c174f20b4c',
system:
{ dialog_stack: [Object],
dialog_turn_counter: 2,
dialog_request_counter: 2,
_node_output_map: [Object] } } }
{ intents: [ { intent: 'goodbytes', confidence: 1 } ],
entities: [],
input: { text: 'bye' },
output:
{ text: [ 'I didn\'t understand. You can try rephrasing.' ],
nodes_visited: [ 'Anything else' ],
log_messages: [] },
context:
{ conversation_id: '7cc96494-d108-4dc9-95c4-63c174f20b4c',
system:
{ dialog_stack: [Object],
dialog_turn_counter: 2,
dialog_request_counter: 2,
_node_output_map: [Object],
branch_exited: true,
branch_exited_reason: 'completed' } } }
非常感谢,它确实指出了我在正确的道路上,但是我要为这个问题添加具体解决方案的答案。 – Luillyfe