我正在為Oracle Chatbot編寫組件,但是我不能也不知道要調(diào)試我的代碼。我的組件成功導(dǎo)入了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(); }};我想知道如何調(diào)試為屬性numberDocument設(shè)置值的組件。
如何在Oracle Digital Assistant中調(diào)試自定義組件?
慕慕森
2021-03-30 10:26:37