UNPKG

@payfit/unity-components

Version:

28 lines (27 loc) • 1.17 kB
/** * Describes the request lifecycle so Composer parts can present the right * controls while a person writes, sends, or stops a prompt. * @remarks * - `enabled` accepts a new prompt. * - `loading` marks a submitted prompt while the request starts. * - `streaming` turns the primary action into a stop control. * - `disabled` disables the prompt and actions. */ export type AIComposerState = 'disabled' | 'loading' | 'streaming' | 'enabled'; /** * Selects whether plain Enter sends a ready prompt or adds a new line. * @remarks * `submit` is the default and keeps Shift+Enter for new lines. `newline` * reserves Enter for new lines and requires the primary action to send. */ export type AIComposerEnterKeyBehavior = 'submit' | 'newline'; export interface AIComposerContextValue { enterKeyBehavior: AIComposerEnterKeyBehavior; state?: AIComposerState; onStop?: () => void; requestSubmit: () => void; hasValue: boolean; setHasValue: (hasValue: boolean) => void; } export declare const AIComposerContextProvider: import('react').Provider<AIComposerContextValue>; export declare const useAIComposerContext: () => AIComposerContextValue;