【问题标题】:Is there a way to directly set fulfillment messages using dialogflow app instance using actions on google client library有没有办法使用 google 客户端库上的操作使用 dialogflow 应用程序实例直接设置履行消息
【发布时间】:2020-05-11 21:17:51
【问题描述】:

我们有一个与 Actions on Google 以及 Dialogflow Phone Gateway 集成的 Dialogflow 代理。我们使用 webhook 实现来处理许多意图并使用 SSML 生成响应。 AoG 客户端库中的 Dialogflow 模块目前不支持电话网关集成。有没有办法使用正确的信息访问和设置 Dialogflow 响应对象的履行消息对象,以便响应与电话网关一起使用? Dialogflow 模块(在 AoG 上)的应用程序实例仅支持不允许直接操作底层 JSON 对象的 conv.ask 和 conv.close 函数。电话网关需要履行消息对象中的特定值才能激活 SSML 文本转语音。

任何指针表示赞赏。

【问题讨论】:

    标签: dialogflow-es actions-on-google


    【解决方案1】:

    要操作响应的 JSON 正文,您可以使用 conv.serialize。要替换响应,您可以使用 conv.json 和更新的有效负载作为参数。

    这个策略在Session Entities plugin库中采用:

    const responseBody = this.conv.serialize() as ResponseBody
    const convBody = this.conv.body as GoogleCloudDialogflowV2WebhookRequest
    responseBody.sessionEntityTypes = this.entities.map(entity => {
      entity.name = `${convBody.session}/entityTypes/${entity.name}`
      return entity
    })
    this.conv.json(responseBody)
    

    【讨论】:

      猜你喜欢
      • 2020-12-17
      • 2019-10-16
      • 2013-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-22
      • 1970-01-01
      • 2011-08-28
      相关资源
      最近更新 更多