2017-11-29 34 views
5

तक पहुंचने के दौरान कोई मिलान करने वाला इरादा हैंडलर: शून्य" मैं संवाद प्रवाह से वेबहूक को कॉल करने की कोशिश कर रहा हूं और वेबहूक से प्रतिक्रिया प्राप्त नहीं कर रहा हूं, प्रतिक्रिया प्रतिक्रिया से मुझे प्राप्त प्रतिक्रिया, जो मैं इरादा रख दिया है मैंने प्रत्येक इरादे के लिए वेबहुक भी सक्षम किया है और वेबहूक यूआरएल भी लगाया है, जो पूर्ण यूआरएल अनुभाग में फायरबेस सीएलआई से उत्पन्न होता है। मैं फायरबेस लॉग और जेएसओएन प्रतिक्रिया के स्क्रीनशॉट को जोड़ रहा हूं जो हम संवाद प्रवाह "जेएसओएन" और 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 response in dialogflow

firebase log

+0

क्या आप अपने इनपुट के स्क्रीन शॉट्स जोड़ सकते हैं। खोज इरादा और input.welcome डायलॉगफ्लो से इरादा? – Prisoner

+0

यहां मेरे इरादे की छवि यूआरएल –

+0

है डायलॉगफ्लो से मेरे इरादों की छवि यूआरएल है। 1. https://imgur.com/a/NcM4z 2. https://imgur.com/a/NcM4z 3.https: //imgur.com/a/NcM4z 4. https://imgur.com/a/NcM4z –

उत्तर

0

हर एजेंट के लिए वहाँ, इस तरह के अशक्त के रूप में अप्रत्याशित स्थिति से निपटने के लिए एक unknown आशय हैंडलर होने की जरूरत है आदि

'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); 
} 
+1

मैंने अपनी स्क्रिप्ट में "input.unknown" जोड़ा है लेकिन एक ही त्रुटि प्राप्त करने में काम नहीं कर रहा है। –

4

मैं सिर्फ यह ठीक उसी त्रुटि का सामना किया है और यह कारण होता था क्योंकि मैं लगाना भूल गए Actions अनुभाग के Enter action name फ़ील्ड में मेरा इरादा नाम।

तो, यह इरादा नाम के रूप में null पास कर रहा था क्योंकि मैंने एक निर्दिष्ट नहीं किया था।

मैं केवल यह से पता लगा बहुत सावधानी से फिर से पढ़ने https://developers.google.com/actions/dialogflow/first-app

+1

आपकी प्रतिक्रिया के लिए धन्यवाद, लेकिन मैंने क्रिया अनुभाग में कार्रवाई का नाम रखा है। मेरे इरादों के स्क्रीनशॉट लिंक यहां दिए गए हैं। imgur.com/a/NcM4z –

1

आपके मूल्यवान प्रतिक्रियाओं के लिए सभी को धन्यवाद। किसी भी तरह, मैं इस शून्य त्रुटि को ठीक करने में सक्षम हूं। दरअसल, मैंने एजेंट के लिए एपीआई संस्करण खंड में "डायलॉगफ्लो वी 2 एपीआई" सक्षम किया था। अब, मैंने इसे अक्षम कर दिया है और यह मेरे लिए काम करता है।

संबंधित मुद्दे