hugbot
Version:
Chatbot maker for HuggingFace Inference API and other AI API providers and backends.
25 lines • 935 B
JavaScript
import { HugBotProxy } from "./AbstractSingletonProxyFactoryBean";
/**
* Bot builder function. Takes component instances and returns proxied HugBot entity.
*/
export 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 HugBotProxy(bot);
};
return { fromComponents };
};
export var Res;
(function (Res) {
Res["Success"] = "Success";
Res["Failure"] = "Failure";
})(Res || (Res = {}));
//# sourceMappingURL=HugBotEntity.js.map