【问题标题】:How to know if the bot is using voice or text in Lex如何知道机器人是否在 Lex 中使用语音或文本
【发布时间】:2019-12-03 16:52:10
【问题描述】:

在从 Lex 调用的 Lambda 函数中,我们需要知道请求是来自 Connect 还是来自控制台或其他聊天工具等文本源。

我们主要需要知道这一点来决定是否需要使用纯文本或 SSML 进行响应。

【问题讨论】:

    标签: aws-lex


    【解决方案1】:

    您需要查看请求属性x-amz-lex:accept-content-types。例如,在 Node.js 函数中,您可以这样做:

    function canUseSSML(event) {
        if (event.requestAttributes) {
            if(event.requestAttributes['x-amz-lex:accept-content-types'] && event.requestAttributes['x-amz-lex:accept-content-types'].indexOf('SSML') != -1) {
                return true;
            }
        }
        return false;
    }
    

    【讨论】:

      猜你喜欢
      • 2021-12-13
      • 1970-01-01
      • 2021-08-18
      • 1970-01-01
      • 1970-01-01
      • 2018-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多