无法使用Actions SDK读取意图 [英] Unable to read intents using Actions SDK
问题描述
我的action.json文件中有以下操作,
I've got the following action in my action.json file,
{
"description": "Recommend movies",
"initialTrigger": {
"intent": "GIVE_RECOMMENDATION",
"queryPatterns": [
{"queryPattern": "What should I watch?"},
{"queryPattern": "Give me a recommendation"},
{"queryPattern": "Tell me a good ($String:genre)? movie"}
]
},
"httpExecution": {
"url":"my webhook URL here"
}
}
在我的API上,我得到了:
On my API, I've got:
app.post('/', function(req, res){
let assistant = new ActionsSdkAssistant({request: req, response: res});
console.log('Current intent: ' + assistant.getIntent());
}
当我模拟自己的动作并说我应该看什么?,当前的意图始终是 assistant.intent.action.TEXT。为什么从来没有'GIVE_RECOMM
When I simulate my action, and say "What should I watch?", the current intent is ALWAYS 'assistant.intent.action.TEXT'. Why is it never 'GIVE_RECOMMENDATION', like its supposed to be?
推荐答案
我假设您正在测试自己的技能:
I'm assuming you're testing your skill as such:
打开操作名称
open ACTION NAME
我应该看什么?
您可能遇到了与我相同的问题,请查看对
的接受的答案和评论 ExpectedInputs /可能性_intents仅与 assistant.intent.action.TEXT一起使用?
Chances are you're having the same issue I had, see the accepted answer and comments to ExpectedInputs / possible_intents only works with "assistant.intent.action.TEXT"?
简而言之:最初的意图被触发后(即打开技能后),Actions SDK仅支持assistant.intent.action.TEXT意向,不再进行任何意向匹配。
In short: After the initial intent was triggered (i.e. after you opened your skill) the Actions SDK only supports the assistant.intent.action.TEXT intent and no longer does any intent matching.
意图匹配仅适用于操作的第一次调用:
Intent matching only works for the very first invocation of the action:
问ACTION_NAME我应该看什么?
ask ACTION_NAME What should I watch?
以上应该为您提供正确的意图名称。
The above should give you the correct intent name.
如果您没有自己的系统,建议使用 http://api.ai 自然语言处理,并且需要与用户进行基于意图的对话
Google recommends using http://api.ai if you do not have your own system in place for natural language processing and need to have intent-based dialog with your user
这篇关于无法使用Actions SDK读取意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!