UNPKG

@promptbook/legacy-documents

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

54 lines (53 loc) 2.27 kB
import { type Dispatch, type MutableRefObject, type SetStateAction } from 'react'; import type { SpeechRecognitionErrorCode } from '../../../types/SpeechRecognition'; import type { ChatProps } from './ChatProps'; import type { DictationRefinementSettings } from './refineFinalDictationChunk'; /** * Stable dictation error shape consumed by the correction panel UI. * * @private function of `useChatInputAreaDictation` */ type DictationError = { readonly code?: SpeechRecognitionErrorCode; readonly message: string; }; /** * Props for `useChatInputAreaDictation`. * * @private function of `<ChatInputArea/>` */ type UseChatInputAreaDictationProps = { speechRecognition?: ChatProps['speechRecognition']; speechRecognitionLanguage?: ChatProps['speechRecognitionLanguage']; textareaRef: MutableRefObject<HTMLTextAreaElement | null>; messageContentRef: MutableRefObject<string>; applyMessageContent: (nextContent: string) => void; }; /** * Manages speech-recognition state, transcript refinement, and correction UI. * * @private function of `<ChatInputArea/>` */ export declare function useChatInputAreaDictation({ speechRecognition, speechRecognitionLanguage, textareaRef, messageContentRef, applyMessageContent, }: UseChatInputAreaDictationProps): { speechRecognitionUiDescriptor: import("./resolveSpeechRecognitionUiDescriptor").SpeechRecognitionUiDescriptor; shouldShowDictationPanel: boolean; isDictationPanelExpanded: boolean; toggleDictationPanel: () => void; expandDictationPanel: () => void; dictationInterimText: string; dictationError: DictationError | null; dictationLastFinalChunk: string; dictationEditableChunk: string; setDictationEditableChunk: Dispatch<SetStateAction<string>>; canBacktrack: boolean; dictationSettings: DictationRefinementSettings; handleDictationSettingChange: (settingName: keyof DictationRefinementSettings, checked: boolean) => void; handleToggleVoiceInput: () => void; handleBacktrackLastChunk: () => void; handleApplyCorrection: () => void; handleRetryPermissionRequest: () => void; handleOpenBrowserSettings: () => void; canOpenBrowserSettings: boolean; isBrowserSpeechFallbackSupported: boolean; }; export {};