4

我目前正在尝试使用 REST Web 服务为 google 上的操作编写一个演示。

目前,用户打开操作(“与 testaction 交谈”)并显示欢迎消息(通过主要意图)。此初始意图需要用户响应,并通过 JSON 响应中的 possible_intents 字段设置下一个预期意图

根据文档,我应该能够在 HTTP JSON 响应的 possible_intents 中指定自定义意图。

但是,如果我使用“assistant.intent.action.TEXT”以外的任何意图,一旦我响应初始意图/提示,我会收到以下错误:

对不起,我没听懂。

并且对初始欢迎意图的响应未正确路由到我的服务。

这不起作用:

{
    "response": "...",
    "expectUserResponse": true,
    "conversationToken": "...",
    "audioResponse": "...",
    "debugInfo": {
        "agentToAssistantDebug": {
            "agentToAssistantJson": {
                "conversation_token": "...",
                "expect_user_response": true,
                "expected_inputs": [
                    {
                        "input_prompt": {
                            [...]
                        },
                        "possible_intents": [
                            {
                                "intent": "testintent"
                            }
                        ]
                    }
                ]
            }
        }
    }
}

这有效:

{
    "response": "...",
    "expectUserResponse": true,
    "conversationToken": "...",
    "audioResponse": "...",
    "debugInfo": {
        "agentToAssistantDebug": {
            "agentToAssistantJson": {
                "conversation_token": "...",
                "expect_user_response": true,
                "expected_inputs": [
                    {
                        "input_prompt": {
                            [...]
                        },
                        "possible_intents": [
                            {
                                "intent": "assistant.intent.action.TEXT"
                            }
                        ]
                    }
                ]
            }
        }
    }
}

我的测试意图在操作包中正确定义,如果我直接调用它就可以正常工作。

真的只能使用通用的 TEXT 意图,然后我必须自己在代码中完成所有的文本匹配和意图识别吗?

4

1 回答 1

5

使用 Actions SDK 时,仅支持 TEXT Intent。您必须使用自己的 NLU 来解析用户提供的原始文本输入。

如果你没有自己的 NLU,那么我们推荐使用 API.AI。

于 2017-01-03T23:37:24.810 回答