【问题标题】:Botium with custom payload - DefaultWelcome: bot says undefined具有自定义有效负载的 Botium - DefaultWelcome:bot 说未定义
【发布时间】:2019-03-21 18:35:06
【问题描述】:

我正在尝试使用 botium 测试我的应用程序。我已经使用 botium-cli import dialogflow-conversations 生成了 convo 文件

我有 DefaultWelcome 意图,其有效负载低于

{
  "cutomPayload": {
    "card": {
      "description": "Hey there! I’m a bot that can help you troubleshoot issues with UPS. Please enter the model number"
    }
  }
}

训练阶段如下

just going to say hi
heya
hello hi
howdy
hey there
hi there
greetings
hey
long time no see
hello
lovely day isn't it
I greet you
hello again
hi
hello there
a good day

在我的 convo 文件夹中,我有 DefaultWelcome.convo.txt 和 DefaultWelcome_input.utterances.txt

DefaultWelcome.convo.txt 有

DefaultWelcome

#me
DefaultWelcome_input

#bot
!INCOMPREHENSION

DefaultWelcome_input.utterances.txt 有

DefaultWelcome_input
just going to say hi
heya
hello hi
howdy
hey there
hi there
greetings
hey
long time no see
hello
lovely day isn't it
I greet you
hello again
hi
hello there
a good day

我尝试运行

const BotDriver = require('botium-core').BotDriver;

const driver = new BotDriver();

driver.BuildFluent()
  .ReadScripts('convos')
  .Start()
  .RunScripts()
  .Exec().then(() => {
    console.log('READY')
  })
  .catch((err) => {
    console.log('ERROR: ', err)
  });

但不幸的是我得到了以下输出

botium-connector-dialogflow Start called +256ms
  botium-ScriptingProvider Using utterances expansion mode: all +172ms
  botium-Convo DefaultWelcome/Line 6: user says ConvoStep {
  botium-Convo   sender: 'me',
  botium-Convo   channel: null,
  botium-Convo   messageText: 'just going to say hi',
  botium-Convo   sourceData: undefined,
  botium-Convo   stepTag: 'Line 6',
  botium-Convo   not: false } +0ms
  botium-connector-dialogflow UserSays called +175ms
  botium-connector-dialogflow dialogflow request: {
  botium-connector-dialogflow   "session": "projects/joules-test/agent/sessions/defee8a0-4b08-11e9-93e7-fd1394066413",
  botium-connector-dialogflow   "queryInput": {
  botium-connector-dialogflow     "text": {
  botium-connector-dialogflow       "text": "just going to say hi",
  botium-connector-dialogflow       "languageCode": "en-US"
  botium-connector-dialogflow     }
  botium-connector-dialogflow   },
  botium-connector-dialogflow   "queryParams": null
  botium-connector-dialogflow } +0ms
  botium-connector-dialogflow dialogflow response: {
  botium-connector-dialogflow   "responseId": "27545943-441c-487f-9f45-2cd32e833ace",
  botium-connector-dialogflow   "queryResult": {
  botium-connector-dialogflow     "fulfillmentMessages": [
  botium-connector-dialogflow       {
  botium-connector-dialogflow         "platform": "PLATFORM_UNSPECIFIED",
  botium-connector-dialogflow         "payload": {
  botium-connector-dialogflow           "fields": {
  botium-connector-dialogflow             "cutomPayload": {
  botium-connector-dialogflow               "structValue": {
  botium-connector-dialogflow                 "fields": {
  botium-connector-dialogflow                   "card": {
  botium-connector-dialogflow                     "structValue": {
  botium-connector-dialogflow                       "fields": {
  botium-connector-dialogflow                         "description": {
  botium-connector-dialogflow                           "stringValue": "Hey there! I’m a bot that can help you troubleshoot issues with Back-UPS. Please enter your model number",
  botium-connector-dialogflow                           "kind": "stringValue"
  botium-connector-dialogflow                         }
  botium-connector-dialogflow                       }
  botium-connector-dialogflow                     },
  botium-connector-dialogflow                     "kind": "structValue"
  botium-connector-dialogflow                   }
  botium-connector-dialogflow                 }
  botium-connector-dialogflow               },
  botium-connector-dialogflow               "kind": "structValue"
  botium-connector-dialogflow             }
  botium-connector-dialogflow           }
  botium-connector-dialogflow         },
  botium-connector-dialogflow         "message": "payload"
  botium-connector-dialogflow       }

  botium-Convo DefaultWelcome wait for bot null +3s
  botium-BaseContainer WaitBotSays error Error: Queue.pop timeout after 60000
  botium-BaseContainer     at timeoutRequest (/Users/madhavam/joules-botium/node_modules/botium-core/src/helpers/Queue.js:46:18)
  botium-BaseContainer     at Timeout.timeoutCallback [as _onTimeout] (/Users/madhavam/joules-botium/node_modules/async/dist/async.js:4936:13)
  botium-BaseContainer     at ontimeout (timers.js:427:11)
  botium-BaseContainer     at tryOnTimeout (timers.js:289:5)
  botium-BaseContainer     at listOnTimeout (timers.js:252:5)
  botium-BaseContainer     at Timer.processTimers (timers.js:212:10) +0ms
  botium-Convo DefaultWelcome: bot says undefined +1m
ERROR:  Error: DefaultWelcome/Line 8: bot says nothing
    at Object.fail (/Users/mma/joules-botium/node_modules/botium-core/src/scripting/ScriptingProvider.js:50:15)
    at container.WaitBotSays.then (/Users/madhavam/joules-botium/node_modules/botium-core/src/scripting/Convo.js:64:49)

那么如何解决这个问题呢?无论如何我可以处理意图中的特定响应吗?

【问题讨论】:

    标签: testing dialogflow-es chatbot


    【解决方案1】:

    Botium Dialogflow Connector 的当前限制之一是不支持自定义负载,请参阅:https://github.com/codeforequity-at/botium-connector-dialogflow#open-issues-and-restrictions

    使用 Botium CLI 时,您无需编写任何 Botium 代码 - 您可以使用 cli 运行测试用例:

    > botium-cli run --convos ./convos
    

    更新

    您可以将功能 _DIALOGFLOW_FORCE_INTENT_RESOLUTION_ 设置为 true,以在连接器无法识别任何已知内容时甚至向 Botium 发送响应。那你就差一站了。

    对于实际断言响应,您可以使用集成的 JSON 结构匹配,但由于 Dialogflow 自定义负载结构的性质,您的 convo 文件会变得非常混乱。

    您的 convo 文件应如下所示

    DefaultWelcome
    
    #me
    DefaultWelcome_input
    
    #bot
    {  
       "fulfillmentMessages":[  
          {  
             "platform":"PLATFORM_UNSPECIFIED",
             "payload":{  
                "fields":{  
                   "cutomPayload":{  
                      "structValue":{  
                         "fields":{  
                            "card":{  
                               "structValue":{  
                                  "fields":{  
                                     "description":{  
                                        "stringValue":"Hey there! I’m a bot that can help you troubleshoot issues with Back-UPS. Please enter your model number",
                                     }
                                  }
                               },
                            }
                         }
                      },
                   }
                }
             },
          }
       ]
    }
    

    【讨论】:

    • 我试图在它自己的服务器中自动化测试。所以不使用 CLI。在我的本地我可以使用并且所有测试都通过了。
    • 添加了您在原始帖子中的选项。
    猜你喜欢
    • 2019-01-23
    • 2011-12-17
    • 1970-01-01
    • 2016-12-25
    • 2018-04-11
    • 2021-02-20
    • 2019-04-01
    • 2014-12-19
    • 1970-01-01
    相关资源
    最近更新 更多