简体   繁体   English

Dialogflow fulfillment 不响应关键字

[英]Dialogflow fulfillment not responding to keywords

I am trying to make sense of how the fulfillment works, and I cannot get the responses from the if statements to work.我试图弄清楚实现是如何工作的,但我无法让 if 语句的响应起作用。 Whenever I write the keyword, the default response I get is Not available .每当我写关键字时,我得到的默认响应是Not available The webhook for the intent is enabled, the entity is 'hooked' in the intent as well.意图的 webhook 已启用,实体也在意图中“挂钩”。 What am I missing here?我在这里错过了什么?

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

const WELCOME_INTENT = 'Default Welcome Intent';
const USER_MESSAGE_ENTITY = 'UserMessage';

app.intent(WELCOME_INTENT, (conv) => {
  const userMessage = conv.parameters(USER_MESSAGE_ENTITY).toLowerCase();
  if (userMessage == 'hey') {
    conv.ask('Hey there');
  } else if (userMessage == 'greetings') {
    conv.ask('Greetings, how are you');
  } else if (userMessage == 'evening') {
    conv.ask('Good evening');
  }
});

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

默认欢迎意图

实体

在此处输入图像描述

{
  "responseId": "8499a8f2-b570-4fb2-9f3c-262bd03db01e-c4f60134",
  "queryResult": {
    "queryText": "hey",
    "action": "input.welcome",
    "parameters": {
      "UserMessage": "hey"
    },
    "allRequiredParamsPresent": true,
    "intent": {
      "name": "projects/wandlee-zad-rekrutacyjne--euol/agent/intents/d76ffc6c-c724-4fa4-8c9b-7178a2d7f9b7",
      "displayName": "Default Welcome Intent"
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {
      "webhook_latency_ms": 76
    },
    "languageCode": "pl",
    "sentimentAnalysisResult": {
      "queryTextSentiment": {
        "score": 0.2,
        "magnitude": 0.2
      }
    }
  },
  "webhookStatus": {
    "code": 14,
    "message": "Webhook call failed. Error: UNAVAILABLE."
  }
}

I don't know where you got conv.parameters(USER_MESSAGE_ENTITY) .我不知道你从哪里得到conv.parameters(USER_MESSAGE_ENTITY)

The parameters of the intent are accessible as a second function argument .意图的参数可作为第二个 function 参数访问。 It is going to be a map:它将是一个 map:

app.intent(WELCOME_INTENT, (conv, params) => {
  const userMessage = params[USER_MESSAGE_ENTITY].toLowerCase();
  // ...
})
``

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Dialogflow ES 执行没有回复 - Dialogflow ES fulfillment did not reply 代码在 Dialogflow 实现中不起作用 - code does not work in Dialogflow fulfillment 如何在 Dialogflow 实现中获取当前意图的名称? - How to get current intent's name in Dialogflow fulfillment? 我如何通过 Dialogflow Fulfillment 将快速回复发送到 Facebook - How can i send Quick Replies to Facebook Through Dialogflow Fulfillment 测试 Google Assistant 未连接到我的 Dialogflow Webhook fulfillment - Test Google Assistant is not connecting with my Dialogflow Webhook fulfillment 从 dialogflow fulfillment webhook 将数据保存到用户存储中 - Saving data into user storage from dialogflow fulfillment webhook 有没有一种方法可以使用 dialogflow 应用程序实例使用谷歌客户端库上的操作直接设置实现消息 - Is there a way to directly set fulfillment messages using dialogflow app instance using actions on google client library 我可以通过 python API 获取 Dialogflow CX 中的所有 Route Fulfillment 消息吗? - Can I get all Route Fulfillment messages in Dialogflow CX by python API? 如何在不使用 webhook 客户端的情况下设置 dialogflow fulfillment response json 上下文? - How to set dialogflow fulfillment response json context without using webhook client? 在访问 dialogflow webhook url 中提供的 fulfillment URL 时,我在谷歌智能家居中遇到后端故障错误 - I'm getting backend failure error in google smart home while accessing fulfillment URL provided in dialogflow webhook url
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM