访问网络钩子 URL 时收到错误"Action Error: no matching intent handler for: null"



我试图从对话框流来调用webhook,而不是从webhook那里获得响应,这是我从响应部分中得到的响应,我是我意图的。我还启用了每个意图的Webhook,并放置了Webhook URL,该网络网络是由Firebase CLI生成的履行URL部分。我正在附加Firebase Log和JSON响应的屏幕截图,我们还会在对话框流中看到"显示JSON"和INDEX.JS文件。我陷入了2周以解决它。

'use strict';
process.env.DEBUG = 'actions-on-google:*';
const { DialogflowApp } = require('actions-on-google');
const functions = require('firebase-functions');
let express = require('express');
let bodyParser = require('body-parser');
// Constants for Dialogflow Agent Actions
let app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json({type: 'application/json'}));
const BYE_RESPONSE = 'input.search';
const WELCOME = 'input.welcome';
exports.helloAssistant = functions.https.onRequest((req, res) => {
  console.log('Request headers: ' + JSON.stringify(req.headers));
  console.log('Request body: ' + JSON.stringify(req.body));
  const asst = new DialogflowApp({request: req, response: res});
  // Welcome
  function welcome(asst) {
    asst.ask('Want to search product or order history');
    asst.tell('hello Neeraj!');
  }
  // Leave conversation with SimpleResponse
  function byeResponse (asst) {
    app.post('/',function (req, res) {
      var myProduct = req.body.result.parameters["productParameter"];
      //let intent=asst.getIntent();
      var address ="https://ipadress/rest/v2/electronics/products/search";
      var address1="https://ipadress";
      switch(myProduct){
        case 'BYE_RESPONSE':
          req.post(address);
          break;
        case 'WELCOME':
          asst.tell('welcome!');
          break;
        default:
          req.post(address1);
          break;
      }
      asst.tell('We swear to serve the master of the Precious.');
    });
  }
  const actionMap = new Map();
  actionMap.set(WELCOME, welcome);
  actionMap.set(BYE_RESPONSE, byeResponse);
  actionMap.set(WELCOME, welcome);
  asst.handleRequest(actionMap);
});

.json响应在DialogFlow

.firebase log

我只是遇到了完全相同的错误,这是因为我忘了将我的意图名称放在Enter action name Actions节的CC_1字段中。

所以,它将null作为意图名称传递,因为我没有指定一个。

我只通过非常小心地重新阅读https://developers.google.com/actions/dialogflow/first-app。

谢谢大家的宝贵回应。不知何故,我可以解决此空错误。实际上,我在代理的API版本部分中启用了" DialogFlow V2 API"。现在,我已经禁用了它,它对我有用。

对于每个代理商

'input.unknown': () => {
  // The default fallback intent has been matched, try to recover.
  // Define the response users will hear
  responseJson.speech = 'I'm having trouble, can you try that again?';
  // Define the response users will see
  responseJson.displayText = 'I'm having trouble :-/ can you try that again?';
  // Send the response to API.AI
  // response.json(responseJson);
  callback(null, responseJson);
}

相关内容

最新更新