UNPKG

@promptbook/vercel

Version:

Promptbook: Turn your company's scattered knowledge into AI ready books

86 lines (85 loc) 2.84 kB
import type { ChatProps } from '../Chat/ChatProps'; /** * Delay configuration for the MockedChat component * * @public exported from `@promptbook/components` */ export type MockedChatDelayConfig = { /** * Delay before showing the first message (ms) * @default 1000 */ beforeFirstMessage?: number | [number, number]; /** * Emulated thinking time between messages (ms) * Can be a fixed number or [min, max] for random range. * @default 2000 */ thinkingBetweenMessages?: number | [number, number]; /** * Wait time after each written word (ms) * Can be a fixed number or [min, max] for random range. * @default 100 */ waitAfterWord?: number | [number, number]; /** * Extra delay on top of the word waiting (ms) * Can be a fixed number or [min, max] for random range. * @default 50 */ extraWordDelay?: number | [number, number]; /** * Chance (0-1) that a longer pause occurs before a message (e.g. agent switch) * @default 0.2 */ longPauseChance?: number; /** * Range for long pause duration (ms), [min, max] * @default [1200, 3500] */ longPauseDuration?: [number, number]; /** * If true, disables typing effect and shows full message at once (BLOCKY_FLOW) */ blocky?: boolean; /** * This prop will allow to show N first messages immediately, while the rest will be typed out with delays * @default 0 */ showIntermediateMessages?: number; }; /** * Props for MockedChat component * * @public exported from `@promptbook/components` */ export type MockedChatProps = Omit<ChatProps, 'onReset' | /*'onMessage' | */ 'onUseTemplate' | 'isVoiceRecognitionButtonShown'> & { /** * Whether the chat can be reset via the "New chat" button. * * When true (default), the reset button is shown and clicking it restarts the simulated flow. * When false, the reset button is hidden (read-only simulation without manual restart). * * @default true */ isResettable?: boolean; /** * Optional delays configuration for emulating typing behavior */ delayConfig?: MockedChatDelayConfig; /** * When true, shows Pause/Resume control and allows pausing the simulated flow. * Pausing finishes the currently typing message first (transitions via PAUSING state), * then prevents new messages from starting until resumed. * * @default true */ isPausable?: boolean; }; /** * MockedChat component that shows the same chat as Chat but emulates ongoing discussion * with realistic typing delays and thinking pauses. * * @public exported from `@promptbook/components` */ export declare function MockedChat(props: MockedChatProps): import("react/jsx-runtime").JSX.Element;