Unable to read intents using Actions SDK

我的未来我决定 提交于 2019-12-08 02:03:47

问题


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"
    }
}

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());
}

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?


回答1:


I'm assuming you're testing your skill as such:

open ACTION NAME

What should I watch?

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"?

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:

ask ACTION_NAME What should I watch?

The above should give you the correct intent name.

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



来源:https://stackoverflow.com/questions/41491444/unable-to-read-intents-using-actions-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!