【问题标题】:Unable to create bot using AWS Lex Api无法使用 AWS Lex Api 创建机器人
【发布时间】:2017-08-22 15:28:53
【问题描述】:

目前,我正在使用 lex 开发聊天机器人平台,但每当我尝试创建机器人时,它总是给我一个错误响应

这是我的代码

 @lex = Aws::LexModelBuildingService::Client.new
    params =
    {
      "name": "TestBot",
      "abortStatement": {
          "messages": [
              {
                  "content": "Sorry, I'm not able to assist at this time",
                  "contentType": "PlainText"
              }
          ]
      },
       "child_directed": true,
       "clarificationPrompt": {
          "maxAttempts": 3,
          "messages": [
             {
               "content": "I didn't understand you, what would you like to do?",
               "contentType": "PlainText"
             }
          ]
       },
       "description": "Test Bot ",
       "idleSessionTTLInSeconds": 600,
       "locale": "en-US",
       "voiceId": "Salli"
    }
    @lex.put_bot(params)

错误

ArgumentError: parameter validator found 4 errors:
  - unexpected value at params[:abortStatement]
  - unexpected value at params[:clarificationPrompt]
  - unexpected value at params[:idleSessionTTLInSeconds]
  - unexpected value at params[:voiceId]

有什么建议吗?

【问题讨论】:

    标签: amazon-web-services bots


    【解决方案1】:

    好吧,我想出了解决方案。密钥应小写,每个单词必须用“_”分隔。这是参数的代码

    {
      "name": "TestBot",
      "abort_statement": {
          "messages": [
              {
                  "content": "Sorry, I'm not able to assist at this time",
                  "content_type": "PlainText"
              }
          ]
      },
       "child_directed": true,
       "clarification_prompt": {
          "max_attempts": 3,
          "messages": [
             {
               "content": "I didn't understand you, what would you like to do?",
               "content_type": "PlainText"
             }
          ]
       },
       "description": "Test Bot ",
       "idle_session_ttl_in_seconds": 600,
       "locale": "en-US",
       "voice_id": "Salli"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-10
      • 2018-02-18
      • 1970-01-01
      • 2019-04-29
      • 1970-01-01
      • 2020-09-05
      • 2018-06-09
      • 2021-10-16
      相关资源
      最近更新 更多