UNPKG

@botonic/plugin-flow-builder

Version:

Use Flow Builder to show your contents

62 lines (61 loc) 2.83 kB
import { AiAgentArgs, BotContext, GuardrailRule, InferenceResponse, KnowledgeBasesResponse, PluginPreRequest, ResolvedPlugins } from '@botonic/core'; import { FlowContent } from './content-fields'; import { HtFlowBuilderData, HtRatingButton } from './content-fields/hubtype-fields'; export interface InShadowingConfig { allowKeywords: boolean; allowSmartIntents: boolean; allowKnowledgeBases: boolean; } export interface BotonicPluginFlowBuilderOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> { apiUrl?: string; jsonVersion?: FlowBuilderJSONVersion; flow?: HtFlowBuilderData; customFunctions?: Record<any, any>; getAccessToken: () => string; trackEvent?: TrackEventFunction<TPlugins, TExtraData>; getKnowledgeBaseResponse?: KnowledgeBaseFunction<TPlugins, TExtraData>; getAiAgentResponse?: AiAgentFunction<TPlugins, TExtraData>; smartIntentsConfig?: { numSmartIntentsToUse: number; }; inShadowing?: Partial<InShadowingConfig>; contentFilters?: ContentFilter<TPlugins, TExtraData>[]; customRatingMessageEnabled?: boolean; } export type TrackEventFunction<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = (request: BotContext<TPlugins, TExtraData>, eventAction: string, args?: Record<string, any>) => Promise<void>; export type KnowledgeBaseFunction<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = (request: BotContext<TPlugins, TExtraData>, sources: string[], instructions: string, messageId: string, memoryLength: number) => Promise<KnowledgeBasesResponse>; export type AiAgentFunction<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = (request: BotContext<TPlugins, TExtraData>, aiAgentArgs: AiAgentArgs) => Promise<InferenceResponse>; export type ContentFilter<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = (request: BotContext<TPlugins, TExtraData>, content: FlowContent) => Promise<FlowContent> | FlowContent; export interface FlowBuilderApiOptions { url: string; flowUrl: string; flow?: HtFlowBuilderData; accessToken: string; request: PluginPreRequest; } export declare enum ProcessEnvNodeEnvs { PRODUCTION = "production", DEVELOPMENT = "development" } export declare enum FlowBuilderJSONVersion { DRAFT = "draft", LATEST = "latest" } export interface SmartIntentResponse { data: { smart_intent_title: string; text: string; smart_intents_used: { title: string; description: string; }[]; }; } export interface PayloadParamsBase { followUpContentID?: string; } export interface RatingSubmittedInfo extends HtRatingButton { possibleOptions: string[]; possibleValues: number[]; } export { AiAgentArgs, GuardrailRule };