关于检索提示 [英] Regarding retrieving prompts
本文介绍了关于检索提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[我们有一个由两个意图组成的Dialogflow机器人。每个意图都包含一些问题集。 用户回答问题(提示),此过程继续。我们仅在完成意图后才会获得履行文本,但我们需要在完成该特定意图中的每个问题后才能获得履行文本(每个提示)。
帮助我们查找解决方案。
推荐答案
您可以使用WebHook填槽。(在"为此启用WebHook调用"下,启用Enable webhook call for slot filling
按钮)。通过这样做,您仍然可以停留在意图处理程序函数中,并提示您所需的内容,直到您可以完成步骤为止。
例如:
function flight(agent) {
const city = agent.parameters['geo-city'];
const time = agent.parameters['time'];
const gotCity = city.length > 0;
const gotTime = time.length > 0;
if(gotCity && gotTime) {
agent.add(`Nice, you want to fly to ${city} at ${time}.`);
} else if (gotCity && !gotTime) {
agent.add('Let me know which time you want to fly');
} else if (gotTime && !gotCity) {
agent.add('Let me know which city you want to fly to');
} else {
agent.add('Let me know which city and time you want to fly');
}
}
您还可以在Actions-on-Google库上使用此功能。
查看详细信息:
这篇关于关于检索提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文