Почему я получаю сообщение об ошибке Webhook fail error UNAVAILABLE? - PullRequest
0 голосов
/ 05 апреля 2020

Более новый для Dialogflow, но крайне разочарован. Я написал бота из десяти вопросов, составленного из списков. У меня была проблема, из-за которой он продолжал бы отступать, потому что не распознавал элемент, который выбирал из списка. После дальнейшего прочтения документов я добавил раздел ответов для выбранных элементов в начале каждого нового намерения. Тогда все становится странным. Мое первое намерение - грыжа - я выбираю элемент из списка, который затем подводит меня ко второму намерению - «Протрузия», и все работает отлично. В верхней части страницы написано «Вы не выбрали грыжу», а затем отображается следующий вопрос и его список. Тогда вещи расстраиваются. Я написал Protrusion и Os намеренно точно так же. Я удостоверился, что не было никаких небольших грамматических проблем, я проверил, чтобы контексты были правильными, все именно так, как я сделал это для цели грыжи, и все же я получаю сообщение об ошибке, когда выбираю элемент из списка выступов.

Я не могу понять, почему это так. Я могу также скопировать и вставить, и все же, даже если они написаны точно так же, один работает, а другой нет. Я почти уверен, что на данный момент это ошибка Google в понимании ввода, но я понятия не имею, как это исправить. Если у кого-то есть понимание, оно будет очень признательно.

Я включил встроенный код редактора, полученное сообщение об ошибке, подробную информацию и информацию об отладке.

Спасибо всем!

'use strict';

const {
  dialogflow,
  SimpleResponse,
  BasicCard,
  Button,
  Image,
  BrowseCarousel,
  BrowseCarouselItem,
  Suggestions,
  LinkOutSuggestion,
  MediaObject,
  Table,
  List,
  Carousel,
} = require('actions-on-google');
const functions = require('firebase-functions');

const app = dialogflow({debug: true});



app.intent('Hernia', (conv, params, option) => {
  conv.ask('I have a few questions for you. Please select if you currently have a hernia, or bulge around your stoma.');
  conv.ask(new List({
    title: 'Do you currently have a Hernia?',
    items: {
      'NO_HERNIA': {
        synonyms: [
          'No',
          'Negative',
          'No Hernia',
          'None',   
        ],
        title: 'No Hernia',
        description: 'The area around the stoma has no protrusions.',
        image: new Image({
          url: 'https://www.coloplast.com.au/Global/2_Stoma/consumer/Three_types_of_stoma_344x194.jpg',
          alt: 'No Hernia',
        }),
      },
      // Add the second item to the list
      'YES_HERNIA': {
        synonyms: [
          'Yes',
          'Yup',
          'Yes Hernia',
          'I have a hernia',
      ],
        title: 'Hernia',
        description: 'Bulge around the stoma',
        image: new Image({
          url: ' https://www.dansac.com/-/media/images/dansac/articleimages/revised/hernia-stoma_380x291.ashx?la=en-gb&h=291&w=380&hash=A6CC02D4C864DB5A2096481A90EE17D6',
          alt: 'Hernia',
        }),
      },
    },
  }));
});


app.intent('Protrusion', (conv, params, option) => {
   const SELECTED_ITEM_RESPONSES = {
    'NO_HERNIA': 'You selected that you do not have a hernia',
    'YES_HERNIA': 'You selected you have a hernia',
  };
  conv.ask(SELECTED_ITEM_RESPONSES[option]);
  conv.ask('Please select if you currently have a prolapsed, protruding or flush/inverted stoma.');
  conv.ask(new List({
    title: 'How far does your stoma protrude?',
    items: {
      'IS_PROLAPSED': {
        synonyms: [
          'Prolapse'
                  ],
        title: 'Prolapsed',
        description: 'The stoma sticks out 4cm or greater from the surrounding skin.',
        image: new Image({
          url: 'https://media.springernature.com/original/springer-static/image/chp%3A10.1007%2F978-3-030-11181-6_49/MediaObjects/434313_1_En_49_Fig1_HTML.png',
          alt: 'Prolapse',
        }),
      },
      // Add the second item to the list
      'IS_NORMAL': {
        synonyms: [
          'Its Normal',
      ],
        title: 'Normal',
        description: 'Stoma protrudes 2cm to 3.9cm from the surrounding skin.',
        image: new Image({
          url: 'https://www.clinimed.co.uk/images/CliniMed-Stoma-Image.jpg',
          alt: 'Protrusion',
  }),
      },
  // Add the third item to the list
      'SHORT_STOMA': {
        synonyms: [
          'Its Short',
      ],
        title: 'Short',
        description: 'Stoma protrudes less than 1.9cm from the surrounding skin.',
        image: new Image({
          url: 'https://i.pinimg.com/originals/1a/5c/e4/1a5ce409225fa01fc774f24c0e78808d.jpg',
          alt: 'Short Stoma',
  }),
      },
// Add the fourth item to the list
      'FLUSH_STOMA': {
        synonyms: [
          'Its Flush',
      ],
        title: 'Flush or retracted',
        description: 'Stoma is at or below skin level.',
        image: new Image({
          url: 'https://www.convatec.com.au/media/1564/flushstoma_m.jpg?',
          alt: 'Retracted Stoma',
        }),
      },
    },
  }));
});

app.intent('Os', (conv, params, option) => {
    const SELECTED_ITEM_RESPONSES = {
    'IS_PROLAPSED': 'You selected that you have a prolapsed stoma.',
    'IS_NORMAL': 'You selected that you have a normal sized stoma.',
    'SHORT_STOMA': 'You selected that you have a short stoma.',
    'FLUSH_STOMA': 'You selected that you have a flush or retracted stoma.',
  };
  conv.ask(SELECTED_ITEM_RESPONSES[option]);
  conv.ask('Please select where the opening of your stoma is located.');
  conv.ask(new List({
    title: 'Is the opening of your stoma at the top (apex), off centered, or flush with the skin?',
    items: {
      'AT_APEX': {
        synonyms: [
          'Top',
                  ],
        title: 'Apex',
        description: 'The opening of the stoma point out of the top.',
        image: new Image({
          url: ' https://i.pinimg.com/originals/1a/5c/e4/1a5ce409225fa01fc774f24c0e78808d.jpg',
          alt: 'Apex',
        }),
      },
      // Add the second item to the list
      'DEVIATED': {
        synonyms: [
          'Off center',
          'Off to the side',
          'It’s not straight',
      ],
        title: 'Deviated',
        description: 'The opening of the stoma is pointing slightly off to the side of the stoma.',
        image: new Image({
          url: ' https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTfCdlGA1OskDZMMfijcDlmnKqJbjX9L9HGR5GkT1rfPpAAr9lq&usqp=CAU',
          alt: 'Deviated Stoma',
  }),
      },
  // Add the third item to the list
      'FLUSH': {
        synonyms: [
          'At skin level',
          'On its side',
      ],
        title: 'Flush',
        description: 'Stoma opening is at skin level.',
        image: new Image({
          url: ' https://crohnsfighting.com/wp-content/uploads/2017/03/DSC_0325-1024x576.jpg',
          alt: 'Flush with skin',
        }),
      },
    },
  }));
});

app.intent('Abdomen', (conv, params, option) => {
  const SELECTED_ITEM_RESPONSES = {
   'AT_APEX': 'You selected that you have an opening at the top of your stoma.',
    'DEVIATED': 'You selected that you have an opening of the stoma that is deviated.',
    'FLUSH': 'You selected that you have a flush stoma opening.',
  };
  conv.ask(SELECTED_ITEM_RESPONSES[option]);
  conv.ask('Please select what best describes your body shape.');
  conv.ask(new List({
    title: 'Which of the following best describes your body shape?',
    items: {
      'Outward_Plane': {
        synonyms: [
          'Outward',
        ],
        title: 'Outward',
        description: 'Select this if you have an outward or rounded abdomen.',
        image: new Image({
          url: ' https://www.coloplast.ca/Global/Campaigns/BodyCheck/en-cp/q/CPOC_BodyCheck_OpeningAboveSkinLevel_Illustration_e25_299x168.jpg',
          alt: 'Outward body',
        }),
      },
      // Add the second item to the list
      'Flat_Plane': {
        synonyms: [
          'Flat Plane',
          'Flat',
      ],
        title: 'Flat',
        description: 'Select this if you have a flat stomach.',
        image: new Image({
          url: ' https://www.coloplast.com.au/Global/2_Stoma/consumer/BodyCheck_Regular_Illustration_344x194.jpg',
          alt: 'Flat abdominal plane',
  }),
      },
// Add the third item to the list
      'Inward_Plane': {
        synonyms: [
          'Inward Plane',
          'Inward',
      ],
        title: 'Inward',
        description: 'Select this if you have an inward abdomen.',
        image: new Image({
          url: 'https://www.coloplast.com.au/Global/Campaigns/BodyCheck/en-cp/q/CPOC_BodyCheck_InwardFromSide_Illustration_e09_299x168.jpg',
          alt: 'Inward abdominal plane',
        }),
      },
    },
  }));
});

app.intent('Leaks', (conv, params, option) => {
      const SELECTED_ITEM_RESPONSES = {
    'Outward_Plane': 'You selected that you have a outward abdomen.',
'Flat_Plane': 'You selected that you have a flat abdomen.',
'Inward_Plane': 'You selected that you have an inward facing abdomen around the stoma.',
  };
  conv.ask(SELECTED_ITEM_RESPONSES[option]);
  conv.ask('Please select if you currently have issues with pouch leakage.');
  conv.ask(new List({
    title: 'Do you issues with pouch leakage?',
    items: {
      'Yes_Leakage': {
        synonyms: [
          'Leakage',
        ],
        title: 'Leakage',
        description: 'Select this if you are having issues with leaking.',
        image: new Image({
          url: 'https://www.veganostomy.ca/wp-content/uploads/2015/08/Ostomy-leak-1024x622.jpg',
          alt: 'Leakage',
        }),
      },
      // Add the second item to the list
      'No_Leakage': {
        synonyms: [
          'No leakage',
          'No Leakage Issue',
      ],
        title: 'No leakage',
        description: 'Select this if you have not had any issues with your pouch leaking.',
        image: new Image({
          url: 'https://image.shutterstock.com/image-photo/front-view-on-colostomy-pouch-260nw-1318442990.jpg',
          alt: 'No Leaks',
        }),
      },
    },
  }));
});

app.intent('Pouch', (conv, params, option) => {
   const SELECTED_ITEM_RESPONSES = {
'Yes_Leakage': 'You selected that you do have issues with leaking.',
'No_Leakage': 'You selected that you do not have issues with leaking.',
  };
  conv.ask(SELECTED_ITEM_RESPONSES[option]);
  conv.ask('Please select if you would prefer a one or two piece system.');
  conv.ask(new List({
    title: 'Would you prefer a one piece or two-piece system?',
    items: {
      'One_Piece': {
        synonyms: [
          'One Piece',

        ],
        title: 'One Piece',
        description: 'A one piece system has both the flange and pouch attached.',
        image: new Image({
          url: 'https://www.exmed.net/blog/ostomyhelp/image.axd?picture=2013%2F10%2F1pieceostomy.jpg',
          alt: 'One piece system',
        }),
      },
      // Add the second item to the list
      'Two_Piece': {
        synonyms: [
          'Two Piece',

      ],
        title: 'Two Piece',
        description: 'A two piece system has a separate flange and pouch which connect together.',
        image: new Image({
          url: 'https://www.exmed.net/images/Product/large/hollister-new-image-colostomyileostomy-flexwear-kit-RFPZVKCVN.jpg',
          alt: 'Two Piece System',
        }),
      },
    },
  }));
});

  app.intent('Transparency', (conv, params, option) => {
  const SELECTED_ITEM_RESPONSES = {
 'One_Piece': 'You selected that you would prefer a once piece pouch.',
'Two_Piece': 'You selected that you would prefer a two piece pouch.',
  };
  conv.ask(SELECTED_ITEM_RESPONSES[option]);
  conv.ask('Please select if you would prefer a transparent or opaque pouch.');
  conv.ask(new List({
    title: 'Would you prefer a transparent or opaque pouch?',
    items: {
      'Yes_Transparent': {
        synonyms: [
          'Transparent',
          'Clear',
          'See through',
        ],
        title: 'Transparent',
        description: 'A pouch which can be seen through.',
        image: new Image({
          url: 'https://cdn11.bigcommerce.com/s-76ccf/images/stencil/1280x1280/products/9885/51555/Hollister_8331__33584.1522875866.jpg',
          alt: 'Transparent Pouch',
        }),
      },
      // Add the second item to the list
      'Yes_Opaque': {
        synonyms: [
          'Opaque',
          'Covered',
      ],
        title: 'Opaque',
        description: 'A pouch which you cannot see through.',
        image: new Image({
          url: 'https://imgcdn.mckesson.com/CumulusWeb/Images/High_Res/883914.jpg',
          alt: 'Opaque Pouch',
        }),
      },
    },
  }));
  });





exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

Это ошибка, которую я получаю при тестировании с помощником Google:

MalformedResponse
Failed to parse Dialogflow response into AppResponse because of invalid platform response: Could not find a RichResponse or SystemIntent in the platform response for agentId: 82594a64-3392-43d1-9bc6-626f0a12809b and intentId: 6f050a45-b89c-4019-8cb1-f907779d1536. WebhookStatus: code: 14 message: "Webhook call failed. Error: UNAVAILABLE." ..

Подробную информацию об ошибке можно найти здесь:

{
 insertId: "1ork92gfh2hapz"  
 labels: {
  channel: "preview"   
  querystream: "GOOGLE_USER"   
  source: "JSON_RESPONSE_VALIDATION"   
 }
 logName: "projects/oliviav3-sgpsej/logs/actions.googleapis.com%2Factions"  
 receiveTimestamp: "2020-04-05T17:57:35.804499554Z"  
 resource: {
  labels: {…}   
  type: "assistant_action"   
 }
 severity: "ERROR"  
 textPayload: "MalformedResponse: Failed to parse Dialogflow response into AppResponse because of invalid platform response: Could not find a RichResponse or SystemIntent in the platform response for agentId: 82594a64-3392-43d1-9bc6-626f0a12809b and intentId: 6f050a45-b89c-4019-8cb1-f907779d1536. WebhookStatus: code: 14
message: "Webhook call failed. Error: UNAVAILABLE."
."  
 timestamp: "2020-04-05T17:57:35.781190176Z"  
 trace: "projects/870664767907/traces/ABwppHF9N7HokbCheah--1y6_ZvVqrFCIjuQmEkKLak-vsMzQcMr_oSILR_UHzE0TO9kBVfZLT_LWvYDtg7a"  
}

Вот отладочная информация:

{
  "response": "Sorry, my test app isn't responding right now. Please try again soon.",
  "expectUserResponse": false,
  "conversationToken": "ErQES200d0...",
  "audioResponse": "//NExAAAAA...",
  "ssmlMarkList": [],
  "debugInfo": {
    "assistantToAgentDebug": {
      "curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=05521a13dc074fda8e2a88ddf6197795' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6IjI1N2Y2YTU4MjhkMWU0YTNhNmEwM2ZjZDFhMjQ2MWRiOTU5M2U2MjQiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdWQiOiJvbGl2aWF2My1zZ3BzZWoiLCJuYmYiOjE1ODYxMDkxNTUsImlhdCI6MTU4NjEwOTQ1NSwiZXhwIjoxNTg2MTA5NTc1LCJqdGkiOiJjNGE4MDIxZGNkZmQ4NjZjMzFkNzViMjZiMGIxYzBmNDUzYWI5MWQ5In0.LI5948F8u32KE-S9Ah91KymKLb8_yyqFUNhw0Czz8Z1HU994lhlrcdXv-j9a4oLylj_ly3b3M0xo9tayf7PUfRSvY7Kn314i1SbsZjtsjmXjmotyApSl1bayy6UlRhs-htofC_oc5XtW_vIA5Vuw3WuCUQrY07ZtUDYzDtR4O-WGeYOVFGm_Dz3FfzFN9kz5cxOf_Q_eezdYEEQTiGuNMGNmLlUnfagtCRa9QjTYQzDONpwK_-ITJXAjf4JkJSuP4Fy76w-oPzOXafpKz4GWmnIuCuFe6RNI423rSf7pNxjcCVwJwzp5uybndkW7pdkGQVubsJKJQSlyknq_fyT1-A'  -A Google-ActionsOnGoogle/1.0 -X POST -d '{\"user\":{\"locale\":\"en-US\",\"lastSeen\":\"2020-04-05T17:57:32Z\",\"userVerificationStatus\":\"VERIFIED\"},\"conversation\":{\"conversationId\":\"ABwppHF9N7HokbCheah--1y6_ZvVqrFCIjuQmEkKLak-vsMzQcMr_oSILR_UHzE0TO9kBVfZLT_LWvYDtg7a\",\"type\":\"ACTIVE\",\"conversationToken\":\"[\\\"get_os\\\",\\\"get_protrusion\\\"]\"},\"inputs\":[{\"intent\":\"actions.intent.OPTION\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"Prolapsed\"}],\"arguments\":[{\"name\":\"OPTION\",\"textValue\":\"IS_PROLAPSED\"},{\"name\":\"text\",\"rawText\":\"Prolapsed\",\"textValue\":\"Prolapsed\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.ACCOUNT_LINKING\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"}]}],\"requestType\":\"SIMULATOR\"}'",
      "assistantToAgentJson": "{\"user\":{\"locale\":\"en-US\",\"lastSeen\":\"2020-04-05T17:57:32Z\",\"userVerificationStatus\":\"VERIFIED\"},\"conversation\":{\"conversationId\":\"ABwppHF9N7HokbCheah--1y6_ZvVqrFCIjuQmEkKLak-vsMzQcMr_oSILR_UHzE0TO9kBVfZLT_LWvYDtg7a\",\"type\":\"ACTIVE\",\"conversationToken\":\"[\\\"get_os\\\",\\\"get_protrusion\\\"]\"},\"inputs\":[{\"intent\":\"actions.intent.OPTION\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"Prolapsed\"}],\"arguments\":[{\"name\":\"OPTION\",\"textValue\":\"IS_PROLAPSED\"},{\"name\":\"text\",\"rawText\":\"Prolapsed\",\"textValue\":\"Prolapsed\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.ACCOUNT_LINKING\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"},{\"name\":\"actions.capability.WEB_BROWSER\"}]}],\"requestType\":\"SIMULATOR\"}",
      "delegatedRequest": {
        "delegatedRequest": ""
      }
    },
    "agentToAssistantDebug": {
      "agentToAssistantJson": "{\n  \"responseMetadata\": {\n    \"status\": {\n      \"code\": 10,\n      \"message\": \"Failed to parse Dialogflow response into AppResponse because of invalid platform response: Could not find a RichResponse or SystemIntent in the platform response for agentId: 82594a64-3392-43d1-9bc6-626f0a12809b and intentId: 6f050a45-b89c-4019-8cb1-f907779d1536. WebhookStatus: code: 14\\nmessage: \\\"Webhook call failed. Error: UNAVAILABLE.\\\"\\n.\"\n    }\n  }\n}",
      "delegatedResponse": {
        "delegatedResponse": ""
      }
    },
    "sharedDebugInfoList": [
      {
        "name": "ResponseValidation",
        "debugInfo": "",
        "subDebugEntryList": [
          {
            "name": "MalformedResponse",
            "debugInfo": "Failed to parse Dialogflow response into AppResponse because of invalid platform response: Could not find a RichResponse or SystemIntent in the platform response for agentId: 82594a64-3392-43d1-9bc6-626f0a12809b and intentId: 6f050a45-b89c-4019-8cb1-f907779d1536. WebhookStatus: code: 14\nmessage: \"Webhook call failed. Error: UNAVAILABLE.\"\n..",
            "subDebugEntryList": []
          }
        ]
      }
    ],
    "conversationBuilderExecutionEventsList": []
  },
  "visualResponse": {
    "visualElementsList": [
      {
        "displayText": {
          "content": "Sorry, my test app isn't responding right now. Please try again soon."
        }
      }
    ],
    "suggestionsList": [],
    "agentLogoUrl": "https://www.gstatic.com/voice/opa/partner_icons/generic_3p_avatar.png"
  },
  "clientError": 0,
  "is3pResponse": true,
  "clientOperationList": [
    {
      "operationType": 7,
      "exitIndicatorPayLoad": {
        "status": 1
      }
    }
  ],
  "projectName": "",
  "renderedHtml": ""
}
...