UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

78 lines (77 loc) 2.13 kB
/// <reference types="react" /> export declare class SmartInputModel { /** * The value of the input for the AI Prompt Input */ aiPrompt: string; /** * The context for the AI model, this is used to provide context * (or more information related to the prompt) to the AI model */ context: string; /** * Whether the prompt is open or not * @default false */ openPrompt: boolean; /** * The input ref for the input to be augmented */ inputValueRef?: React.RefObject<HTMLInputElement> | null; /** * Whether the ai is currently being prompted or not */ loading: boolean; /** * The onChange function for the input */ onChange?: (value: string) => void; constructor(); /** * Computed value derived from the input ref */ get inputValue(): string | undefined; /** * Set the ai prompt value * @param prompt the Ai Prompt */ setAiPrompt: (prompt: string) => void; /** * Sets the context for the AI model * @param context the context for the AI model */ setContext: (context?: string) => void; /** * Set the prompt to be open or not * @param value boolean, whether the prompt is open or not */ setOpenPrompt: (value: boolean) => void; /** * Toggles the prompt to be open or not */ toggleOpenPrompt: () => void; /** * Sets the loading value * @param value the loading value */ setLoading: (value: boolean) => void; /** * Sets the onChange function * @param onChange the onChange function */ setOnChange: (onChange: (value: string) => void) => void; /** * @param ref the input ref */ setInputRef: (ref: React.RefObject<HTMLInputElement> | null) => void; /** * Query the AI model */ query: () => Promise<void>; } /** * Observable hook for the smart input. Note this is an observable hook. * It can be used outside of react components. * @returns the smart input state */ export declare const useSmartInput: () => SmartInputModel;