【发布时间】:2017-01-08 07:49:40
【问题描述】:
我的故事很少,但如果我尝试输入 blah 之类的内容,wit.ai 使用 hello 故事。
但我需要类似*wildcard 的故事并回复I don't understant。
witbot 和 intents 很容易,但我不知道如何制作 node-wit 和 stories。
【问题讨论】:
标签: wit.ai
我的故事很少,但如果我尝试输入 blah 之类的内容,wit.ai 使用 hello 故事。
但我需要类似*wildcard 的故事并回复I don't understant。
witbot 和 intents 很容易,但我不知道如何制作 node-wit 和 stories。
【问题讨论】:
标签: wit.ai
如果下一步的置信度低于我设置的预定义阈值,我决定调整 wit.js 代码以调用特殊的 lowConfidence 方法。
在我的智慧行动文件中:
// Setting up our wit client
const witClient = new Wit({
accessToken: WIT_TOKEN,
actions: witActions,
lowConfidenceThreshold: LOW_CONFIDENCE_THRESHOLD,
logger: new log.Logger(log.DEBUG)
});
以后
lowConfidence({context}) {
console.log("lowConfidenceConversationResponse");
return new Promise(function(resolve) {
context.lowConfidence=true;
context.done=true;
// now create a low_confidence story in wit.ai
// and have the bot response triggered always
// when context.lowConfidence is set
return resolve(context);
});
}
在 wit.js 中
else if (json.type === 'action') {
let action = json.action;
// json.confidence is confidence of next step and NOT
// wit.ai intent identification confidence
const confidence = json.entities && json.entities.intent &&
Array.isArray(json.entities.intent) &&
json.entities.intent.length > 0 &&
json.entities.intent[0].confidence;
if ( confidence && confidence<lowConfidenceThreshold)
action = 'lowConfidence' ;
【讨论】: