gpt4 book ai didi

node.js - Nodejs SDK - 合并对话框 + 意图

转载 作者:太空宇宙 更新时间:2023-11-04 01:51:12 26 4
gpt4 key购买 nike

有什么方法可以有目的地合并对话框,这样我就不需要多余的代码片段?

 bot.dialog('whats-your-name', require('./dialogs/whats-your-name'))    
intents.matches('whats-your-name', require('./dialogs/whats-your-name'))

最佳答案

您可以将实例化的 IntentDialog 插入根对话框 ("/") 并让 IntentDialog 处理所有路由:

var intents = new builder.IntentDialog({ recognizers: [recognizer] });
bot.dialog("/", intents);

或者您可以放弃 IntentDialog 并将识别器插入机器人级别,如下所示:

bot.recognizer(recognizer);
bot.dialog("/", [ ... ]);

bot.dialog("luisIntentA", [ ... ])
.triggerAction({
matches: "luisIntentA"
});

我建议使用后一种方法,因为这可以更好地控制路由意图和对话框之间的切换。

关于node.js - Nodejs SDK - 合并对话框 + 意图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49636031/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com