我正在为Oracle Chatbot编写组件,但是我不能也不知道要调试我的代码。我的组件成功导入了Oracle Digital Assistant(ODA),但是我还有很多工作需要测试。我的组件:"use strict"module.exports = { metadata: () => ({ "name": "DocumentNumber", "properties": { "numberDocument": { "type": "string", "required": true } }, "supportedActions": [ "allow", "block" ] }), invoke: (conversation, done) => { // Parse a number out of the incoming message const text = conversation.text(); var document = ""; if (text) { const textSize = text.length; if (textSize < 10) { conversation.invalidUserInput("xxxxxx"); done(); return; } else { document = text; } } else { var errText = "xxxx"; conversation.logger().error(errText); done(new Error(errText)); return; } conversation.logger().info('DocumentNumber: using numberDocumento=' + document); var express = require('express'); var linkReturn = ""; axios.put('http://xxxxx', { numeroDocumento: document, filial: 0001 }) .then(function (response) { linkReturn = response; console.log(response); }) .catch(function (error) { linkReturn = ""; console.log(error); }); // Set action based on age check //conversation.invalidUserInput(linkReturn); if (linkReturn !== ""){ conversation.invalidUserInput(linkReturn); conversation.transition('allow'); } else { conversation.invalidUserInput(response.data); conversation.transition('block'); } done(); }};我想知道如何调试为属性numberDocument设置值的组件。
添加回答
举报
0/150
提交
取消