hugbot
Version:
Chatbot maker for HuggingFace Inference API and other AI API providers and backends.
29 lines • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Res = exports.BuildHugBot = void 0;
const AbstractSingletonProxyFactoryBean_1 = require("./AbstractSingletonProxyFactoryBean");
/**
* Bot builder function. Takes component instances and returns proxied HugBot entity.
*/
const BuildHugBot = (id) => {
const bot = Object.create(null);
Object.defineProperty(bot, "id", { value: id, enumerable: true, writable: true, configurable: true });
const fromComponents = (components) => {
Object.entries(components).forEach(([name, component]) => Object.defineProperty(bot, name, { value: component, enumerable: true, writable: true, configurable: true }));
return { build };
};
const build = () => {
if (bot.IObuffer) {
bot.IObuffer.setBot = bot;
}
return (0, AbstractSingletonProxyFactoryBean_1.HugBotProxy)(bot);
};
return { fromComponents };
};
exports.BuildHugBot = BuildHugBot;
var Res;
(function (Res) {
Res["Success"] = "Success";
Res["Failure"] = "Failure";
})(Res || (exports.Res = Res = {}));
//# sourceMappingURL=HugBotEntity.js.map