Dialogflow es 获取TypeError:conv.parameters在app.intent的函数中不是一个带有Dialogflow fufilliment的函数

Dialogflow es 获取TypeError:conv.parameters在app.intent的函数中不是一个带有Dialogflow fufilliment的函数,dialogflow-es,chatbot,Dialogflow Es,Chatbot,我正在努力学习更多关于Dialogflow实现的知识,我正在youtube上学习教程 当我部署和测试时,我会在聊天机器人中得到一个空响应。我可以看到以下错误: TypeError:conv.parameters不是app.intent(/srv/index.js:24:23)中的函数 有没有人能帮我们找到我的错误。代码如下: const functions = require('firebase-functions') const {dialogflow}=require('actions-on

我正在努力学习更多关于Dialogflow实现的知识,我正在youtube上学习教程

当我部署和测试时,我会在聊天机器人中得到一个空响应。我可以看到以下错误: TypeError:conv.parameters不是app.intent(/srv/index.js:24:23)中的函数

有没有人能帮我们找到我的错误。代码如下:

const functions = require('firebase-functions')
const {dialogflow}=require('actions-on-google')

const WELCOME_INTENT = 'Default Welcome Intent'
const FALLBACK_INTENT = 'Default Fallback Intent'
const Dept_ENTITY= 'DEPTChoice'
const Dept_INTENT='DEPT'


const app = dialogflow()

app.intent(WELCOME_INTENT, (conv) => {
    conv.ask("Hi! I am a test bot - what department are you in?")
})

app.intent(FALLBACK_INTENT, (conv) => {
    conv.ask("huh?")
})

app.intent(DEPT_INTENT, (conv) => {
  const dept_type=conv.parameters('DEPTChoice').toLowerCase()
  if (dept_type == "Sales") {
  conv.ask("Great Sales")
  } else   conv.ask("Great - Your in Sales")

})

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

正如错误消息所说,它不是一个函数

它是一个JavaScript对象,其中对象属性是参数的名称。所以你的台词可以写成

const dept_type = conv.parameters['DEPTChoice'].toLowerCase();

请注意,使用方括号
[]
引用对象上的属性,而不是使用圆括号
()
执行函数调用。这可能是因为在视频中很难看到。

正如错误消息所说,这不是一个函数

它是一个JavaScript对象,其中对象属性是参数的名称。所以你的台词可以写成

const dept_type = conv.parameters['DEPTChoice'].toLowerCase();
请注意,使用方括号
[]
引用对象上的属性,而不是使用圆括号
()
执行函数调用。这可能是视频中很难看到的