UNPKG

@botonic/plugin-flow-builder

Version:

Use Flow Builder to show your contents

29 lines 1.33 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { Text } from '@botonic/react'; import { ContentFieldsBase } from './content-fields-base'; export const DISABLED_MEMORY_LENGTH = 1; export class FlowKnowledgeBase extends ContentFieldsBase { constructor() { super(...arguments); this.code = ''; this.feedbackEnabled = false; this.sources = []; this.text = ''; this.sourcesData = []; } static fromHubtypeCMS(component) { const newKnowledgeBase = new FlowKnowledgeBase(component.id); newKnowledgeBase.code = component.code; newKnowledgeBase.feedbackEnabled = component.content.feedback_enabled; newKnowledgeBase.sourcesData = component.content.sources_data; newKnowledgeBase.instructions = component.content.instructions; newKnowledgeBase.hasMemory = component.content.has_memory || false; newKnowledgeBase.memoryLength = component.content.memory_length || DISABLED_MEMORY_LENGTH; return newKnowledgeBase; } toBotonic(id, request) { return (_jsx(Text, Object.assign({ feedbackEnabled: this.feedbackEnabled, inferenceId: this.inferenceId, botInteractionId: request.input.bot_interaction_id }, { children: this.text }), id)); } } //# sourceMappingURL=flow-knowledge-base.js.map