react-ai-faq-chat
Version:
A smart AI-powered FAQ chatbot
23 lines (22 loc) • 731 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReactAIFaqChat = void 0;
const fileLoader_1 = require("./loaders/fileLoader");
const chatbotChain_1 = require("./chain/chatbotChain");
class ReactAIFaqChat {
options;
chatbot;
constructor(options) {
this.options = options;
}
async init() {
const docs = await (0, fileLoader_1.loadDocs)(this.options.docsFolder);
this.chatbot = await (0, chatbotChain_1.createChatbotChain)(docs);
}
async ask(question) {
if (!this.chatbot)
throw new Error("Chatbot not initialized. Call init() first.");
return this.chatbot(question);
}
}
exports.ReactAIFaqChat = ReactAIFaqChat;
;