@convex-dev/agent
Version:
A agent component for Convex.
27 lines • 1.04 kB
TypeScript
export type SmoothTextOptions = {
/**
* The number of characters to display per second.
*/
charsPerSec?: number;
/**
* Whether to initially start streaming.
* If this later turns to false, it'll continue streaming.
* This will start streaming the first value it sees.
*/
startStreaming?: boolean;
};
/**
* A hook that smoothly displays text as it is streamed.
*
* @param text The text to display. Pass in the full text each time.
* @param charsPerSec The number of characters to display per second.
* @returns A tuple of the visible text and the state of the smooth text,
* including the current cursor position and whether it's still streaming.
* This allows you to decide if it's too far behind and you want to adjust
* the charsPerSec or just prefer the full text.
*/
export declare function useSmoothText(text: string, { charsPerSec, startStreaming, }?: SmoothTextOptions): [string, {
cursor: number;
isStreaming: boolean;
}];
//# sourceMappingURL=useSmoothText.d.ts.map