使用 API JSON 的 Dialogflow V2 上下文和操作

Dialogflow V2 Context and Action using API JSON

我正在尝试使用 Google DialogFlow 开发一个机器人,但我在尝试访问 Intent.

中的特定 Action 时遇到问题

我需要接收在 IntentAction 中配置的变量(名称、颜色):

但是,当我对 DialogFlow 进行查询时:

{
    "queryInput": {
        "text": {
            "text": "I need something",
            "languageCode": "en-US"
        }
    },
    "queryParameters" : {
        "contexts" : [ "I put all contexts created here" ]
    }

}

机器人跳过创建的 action 并继续 Default-Intent

不幸的是,Dialogflow 文档中没有足够的信息,您知道我是否也必须通过 JSON 发送该特定操作的名称吗?我能做什么?

我找到了问题的答案。要访问 context 并使用 action parameters,结构是

 "queryParams" : {
 "contexts" : [{
       "name": "Name of the context",
       "lifespanCount": 2,
       "parameters": { "The parameters you are using in that Intent"}
 }]
 }

因此,请使用 queryParams.

而不是 queryParameters