2

我的 action.json 文件中有以下操作,

{
    "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 上,我有:

app.post('/', function(req, res){
    let assistant = new ActionsSdkAssistant({request: req, response: res});
    console.log('Current intent: ' + assistant.getIntent());
}

当我模拟我的动作并说“我应该看什么?”时,当前意图始终是“assistant.intent.action.TEXT”。为什么它从来没有像它应该的那样'GIVE_RECOMMENDATION'?

4

1 回答 1

5

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

于 2017-01-05T22:12:32.887 回答