/** * @description KnowledgeBase Class. * * @deprecated since version 3.0.0 * @class KnowledgeBase * @memberof jibo.kb */ /** The Knowledge Base API. * * Can be accessed via `jibo.kb` (or `import {kb} from 'jibo'`). * * @namespace jibo.kb * * @example * let model = jibo.kb.createModel('/skillname'); * */ /** * Loop model information. * @name jibo.kb#loop * @type {jibo.kb.loop.LoopModel} */ /** * Media list model information. * @name jibo.kb#media * @type {jibo.kb.media.MediaModel} */ /** * Robot properties model information. * @name jibo.kb#robot * @type {jibo.kb.robot.RobotModel} */ /** Create an Error with a good message from an AxiosError object * * @method jibo.kb.KnowledgeBase#_processError * @param {AxiosError} err Axios error object. * @returns {Error} Error object. * @private */ /** Create a KB slice. KB slices must be created before they are * used the first time. This method creates the KB slice, or does * nothing if it has already been created. The callback is * supplied with a boolen indicating if the slice needed to be * created. If callback is omitted a promise is returned instead. * * @method jibo.kb#createSlice * @param {string} sliceName Name of KB slice to create. * KB name must start with a `/`, followed by the skill name. * @param {string} [httpUrl] Base URL of KB service. Defaults to * URL generated from the service object given to `init()`. * @param {Function} [callback] Called with `(err, created)` * arguments. `created` is `false` if the KB slice already * existed. If callback is omitted a promise that returns * `created` is returned instead. * @returns {Promise} A promise that resolves with the value of * `created` if the callback is omitted. */ /** Check if a KB slice exists. The callback is supplied with a * boolen indicating if the slice exists. If callback is omitted a * promise is returned instead. * * @method jibo.kb#existsSlice * @param {string} sliceName Name of KB slice to check. * KB name must start with a `/`, followed by the skill name. * @param {string} [httpUrl] Base URL of KB service. Defaults to * URL generated from the service object given to `init()`. * @param {Function} [callback] Called with `(err, exists)` * arguments. `exists` is `true` if the KB slice exists. If * callback is omitted a promise that returns `exists` is returned * instead. * @returns {Promise} A promise that resolves with the value of * `exists` if the callback is omitted. */ /** Create a new Model object. Models are the primary interface * to the knowledge base. * * @method jibo.kb#createModel * @param {string|string[]} kbNames Array of knowledge base slice * names to include in model, in order of precedence. A single * KB name can be given as a string instead of an array of strings. * KB names must start with a `/`, followed by the skill name. * @param {string} [httpUrl] Base URL of KB. * service. Defaults to URL generated from the service object * given to `init()`. * @param {string} [httpUrl] Base URL of KB service. Defaults to * URL generated from the service object given to `init()`. * @returns {jibo.kb.Model} New Model object. */ /** Register a Node subclass to be instantiated when a node of a * given type is loaded or created. * * @method jibo.kb#registerNodeClass * @param {string|string[]} nodeType Node type to use this * subclass for. * @param {Function} classConstruction The constructor function * for the subclass. * @param {string} [kbName] Name of KB to limit the use * of this subclass to. Defaults to all KBs. */ /** Register a Model subclass to be instantiated for a given KB name * list. * * @method jibo.kb#registerModelClass * @param {string|string[]} kbNames KB name or name list use this * subclass for. * @param {Function} classConstructor The constructor function for * the subclass. */ /** Use the node type to find a Node subclass in the Node Class * registry. Default to the plain `Node` object if nothing * matches. * * @method jibo.kb#findNodeClass * @param {string} nodeType Type of node. * @param {string} kbName Name of KB slice. * @returns {Function} Node class constructor. */ /** Use the given KB slice names to find a Model subclass in the * Model subclass registry. Defaults to the plain `Model` object * if nothing matches. * * @method jibo.kb#findModelClass * @param {string|string[]} kbNames Array of knowledge base slice * names. * @returns {Function} Model class constructor. */ /** Unload a given kb slice from the Skills Service Manager memory * and remove it from disk. Also removes any sub-kbs inside this * slice. For example, if you remove `/jibo`, that would also * remove `/jibo/loop`, `/jibo/settings` and all other kb slices * under `/jibo`. If callback is omitted a promise is returned * instead. * * @method jibo.kb#removeSlice * @param {string} sliceName Name of kb slice to be removed, * including all of its sub-slices (if any). * @param {Function} [callback] Called when done, with `err` * parameter if there was an error. If callback is omitted a * promise is returned instead. * @returns {Promise} A promise if the callback is omitted. */ /** Convert a single item to an array for arguments that may be a * single thing or an array of things. * * @method jibo.kb#_toArray * @private */