@promptbook/remote-server
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
106 lines (105 loc) • 3.57 kB
TypeScript
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' | 'newChatButtonHref' | /*'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;
/**
* Optional absolute offsets (in milliseconds) for each message.
*
* When provided, playback waits according to these deterministic offsets
* instead of random delay heuristics.
*/
readonly messageOffsetsMs?: ReadonlyArray<number>;
/**
* When true, messages typed in the input are appended only in local UI state.
*
* This is useful for demo/recording flows where user interaction should not
* mutate the persisted mocked-chat preset.
*
* @default false
*/
readonly appendMessagesLocallyOnSend?: boolean;
/**
* Optional callback invoked whenever one full simulation run completes.
*/
onSimulationComplete?(): void;
};
/**
* 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;