Dialogflow中的后续意图未触发。怎么了?

时间:2019-05-04 13:07:51

标签: dialogflow

Make Appointment Intent Part 1
Make Appointment Intent Part 2
Appointment Type Intent Part 1
Appointment Type Intent Part 2
Intents Overview
Problem Screenshot from Testing

Webhook源代码:

function createCalendarEvent (dateTimeStart, dateTimeEnd) {
  return new Promise((resolve, reject) => {
    calendar.events.list({  // List all events in the specified time period
      auth: serviceAccountAuth,
      calendarId: calendarId,
      timeMin: dateTimeStart.toISOString(),
      timeMax: dateTimeEnd.toISOString()
    }, (err, calendarResponse) => {
      // Check if there exists any event on the calendar given the specified the time period
      if (err || calendarResponse.data.items.length > 0) {
        reject(err || new Error('Requested time conflicts with another appointment'));
      } else {
        // Create an event for the requested time period
        calendar.events.insert({ auth: serviceAccountAuth,
          calendarId: calendarId,
          resource: {summary: 'DCU Barbers Appointment',
            start: {dateTime: dateTimeStart},
            end: {dateTime: dateTimeEnd}}
        }, (err, event) => {
          err ? reject(err) : resolve(event);
        }
        );
      }
    });
  });
}

JSON请求:

{
  "responseId": "4c7cf836-7567-4885-bea7-271dd5b73cc1",
  "queryResult": {
    "queryText": "2pm",
    "parameters": {
      "time": "2019-05-05T14:00:00+01:00",
      "date": "2019-05-10T12:19:37+01:00"
    },
    "allRequiredParamsPresent": true,
    "fulfillmentText": "Got it. I have your appointment scheduled on 2019-05-10 at 14:00:00. Do you need a haircut or just a shave?",
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            "Alright. Your appointment is scheduled for 2019-05-10 at 14:00:00. Do you need a haircut or just a shave?"
          ]
        }
      }
    ],
    "outputContexts": [
      {
        "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/makeappointment-followup",
        "lifespanCount": 2,
        "parameters": {
          "date": "2019-05-10T12:19:37+01:00",
          "time.original": "2pm",
          "date.original": "friday",
          "time": "2019-05-05T14:00:00+01:00"
        }
      },
      {
        "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_screen_output",
        "parameters": {
          "date": "2019-05-10T12:19:37+01:00",
          "time.original": "2pm",
          "date.original": "friday",
          "time": "2019-05-05T14:00:00+01:00"
        }
      },
      {
        "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_account_linking",
        "parameters": {
          "date": "2019-05-10T12:19:37+01:00",
          "time.original": "2pm",
          "date.original": "friday",
          "time": "2019-05-05T14:00:00+01:00"
        }
      },
      {
        "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_audio_output",
        "parameters": {
          "date": "2019-05-10T12:19:37+01:00",
          "time.original": "2pm",
          "date.original": "friday",
          "time": "2019-05-05T14:00:00+01:00"
        }
      },
      {
        "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/google_assistant_input_type_keyboard",
        "parameters": {
          "date": "2019-05-10T12:19:37+01:00",
          "time.original": "2pm",
          "date.original": "friday",
          "time": "2019-05-05T14:00:00+01:00"
        }
      },
      {
        "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_web_browser",
        "parameters": {
          "date": "2019-05-10T12:19:37+01:00",
          "time.original": "2pm",
          "date.original": "friday",
          "time": "2019-05-05T14:00:00+01:00"
        }
      },
      {
        "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_media_response_audio",
        "parameters": {
          "date": "2019-05-10T12:19:37+01:00",
          "time.original": "2pm",
          "date.original": "friday",
          "time": "2019-05-05T14:00:00+01:00"
        }
      }
    ],
    "intent": {
      "name": "projects/dcubarbers/agent/intents/3d1cbbe9-0ab2-47df-b092-33baf2cc0a45",
      "displayName": "Make Appointment"
    },
    "intentDetectionConfidence": 1,
    "languageCode": "en-us"
  },
  "originalDetectIntentRequest": {
    "source": "google",
    "version": "2",
    "payload": {
      "isInSandbox": true,
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
          },
          {
            "name": "actions.capability.ACCOUNT_LINKING"
          },
          {
            "name": "actions.capability.WEB_BROWSER"
          },
          {
            "name": "actions.capability.SCREEN_OUTPUT"
          },
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          }
        ]
      },
      "requestType": "SIMULATOR",
      "inputs": [
        {
          "rawInputs": [
            {
              "query": "2pm",
              "inputType": "KEYBOARD"
            }
          ],
          "arguments": [
            {
              "rawText": "2pm",
              "textValue": "2pm",
              "name": "text"
            }
          ],
          "intent": "actions.intent.TEXT"
        }
      ],
      "user": {
        "lastSeen": "2019-05-05T11:19:30Z",
        "locale": "en-US",
        "userId": "ABwppHGgb5g3PgauSE8Yo7dtRJpWsjP7D_2Dqy4_QeEoWUENRRrzbzmQOgGFKxVPDrpB9KA9DNjqkA"
      },
      "conversation": {
        "conversationId": "ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA",
        "type": "ACTIVE",
        "conversationToken": "[\"3d1cbbe9-0ab2-47df-b092-33baf2cc0a45_id_dialog_context\",\"actions_capability_account_linking\",\"actions_capability_audio_output\",\"actions_capability_media_response_audio\",\"actions_capability_screen_output\",\"actions_capability_web_browser\",\"google_assistant_input_type_keyboard\",\"make_appointment_dialog_context\",\"make_appointment_dialog_params_time\"]"
      }
    }
  },
  "session": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA",
  "alternativeQueryResults": [
    {
      "queryText": "2pm",
      "outputContexts": [
        {
          "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/makeappointment-followup",
          "lifespanCount": 2,
          "parameters": {
            "date": "2019-05-10T12:19:37+01:00",
            "time.original": "2pm",
            "date.original": "friday",
            "time": "2019-05-05T14:00:00+01:00"
          }
        },
        {
          "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_screen_output",
          "parameters": {
            "date": "2019-05-10T12:19:37+01:00",
            "time.original": "2pm",
            "date.original": "friday",
            "time": "2019-05-05T14:00:00+01:00"
          }
        },
        {
          "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_account_linking",
          "parameters": {
            "date": "2019-05-10T12:19:37+01:00",
            "time.original": "2pm",
            "date.original": "friday",
            "time": "2019-05-05T14:00:00+01:00"
          }
        },
        {
          "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_audio_output",
          "parameters": {
            "date": "2019-05-10T12:19:37+01:00",
            "time.original": "2pm",
            "date.original": "friday",
            "time": "2019-05-05T14:00:00+01:00"
          }
        },
        {
          "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/google_assistant_input_type_keyboard",
          "parameters": {
            "date": "2019-05-10T12:19:37+01:00",
            "time.original": "2pm",
            "date.original": "friday",
            "time": "2019-05-05T14:00:00+01:00"
          }
        },
        {
          "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_web_browser",
          "parameters": {
            "date": "2019-05-10T12:19:37+01:00",
            "time.original": "2pm",
            "date.original": "friday",
            "time": "2019-05-05T14:00:00+01:00"
          }
        },
        {
          "name": "projects/dcubarbers/agent/sessions/ABwppHHaZHZWdBT3Kbfsa_DlHHHalHfkvIXMbj58hGS6gTxBgwUKSOEOE1Ll68VbpiIGkf9gMVwMcA/contexts/actions_capability_media_response_audio",
          "parameters": {
            "date": "2019-05-10T12:19:37+01:00",
            "time.original": "2pm",
            "date.original": "friday",
            "time": "2019-05-05T14:00:00+01:00"
          }
        }
      ],
      "languageCode": "en-us"
    }
  ]
}

JSON响应:

{
  "fulfillmentText": "Got it. I have your appointment scheduled on Friday, May 10 at 2 PM. See you soon. Good-bye.",
  "outputContexts": []
}

我正在 Dialogflow 中设置一个代理。对于客户来说,在理发店预订约会是一种简单的逻辑。这是一个大学项目。

我创建了一个后续意图,询问客户他们需要哪种约会(“理发”或“刮胡子”),在实现“约会”意图后应将其触发。相应的上下文看起来不错,所以我真的不明白这是怎么回事。

此外,我对任何形式的编程都是全新的。所以请耐心等待我。

我从Google一步一步地遵循了本教程(从15:05开始):https://www.youtube.com/watch?v=ADD-rvsS5z4

0 个答案:

没有答案