Chat · Components
AssistantComposer
AssistantComposer - text + attachment composer for AssistantDock (#2904). Enter-to-send / Shift+Enter-for-newline matches the package convention in `../messages/MessageInput.svelte` (same `Textarea` primitive, same `handleKeydown` shape). Attachments use a compact attach button + a small chip row instead of the full `../shared/FileUpload.svelte` dropzone/preview flow, which is sized for a dedicated upload panel, not a one-line composer (#2904 review fix).Public export
typescript
import { AssistantComposer } from '@happyvertical/smrt-chat/svelte';- Import path
@happyvertical/smrt-chat/svelte- Props
- 13
- Props described
- 13 of 13
- Bindable state
- 0
- Callback events
- 2
- Verified release
- 0.57.40
Props
NameTypeRequiredDescription
onsend(content: string, attachments: AssistantAttachmentRef[]) => void | Promise<void>YesCalled with the trimmed message text and any staged attachments when the user sends — via Enter or the Send button. May return a Promise (or reject/throw): the draft text and staged attachments are kept until it settles, cleared only on success (#2904 review finding 4) — a rejection restores them and shows an inline error.onupload(files: FileList) => Promise<AssistantAttachmentRef[]>NoCalled with the picked/dropped files; resolves to the uploaded attachment refs to stage as removable chips above the input.disabledbooleanNoDisables the composer (e.g. no active thread yet).placeholderstringNoPlaceholder text for the empty textarea.valuestringNoThe draft text (#2991). Bindable: a host can seed it with a prompt for the user to edit, and read back what they typed. Setting it never sends. Cleared after `onsend` resolves.dictationDictationSourceProvider | nullNoSpeak instead of typing: a speech source (smrt-svelte's `createSttDictationSource()`). With one, the composer shows a microphone button, and pressing and holding the message box starts listening too (it keeps listening after the finger comes up; tap the microphone, send, or press Escape to stop). Heard words go in at the cursor. Without one there is no microphone.transcribeDictationTranscribe | nullNoWrites a recorded message down, for browsers whose speech recognition is missing or broken (Firefox, Brave): the composer then records the message and shows "Writing it down…" while this runs. Normally smrt-ui's `createHttpTranscriber('/your/route')`. Also shows the microphone on its own, without `dictation`.dictationMode'push' | 'hands-free'No`'hands-free'`: the microphone stays on and each sentence is written down when the speaker pauses, with no tap per phrase; tapping the microphone (or sending, or Escape) ends it. Needs `handsFreeCapture` and an on-device speech source (smrt-svelte's `whisper-local` / `moonshine`); otherwise it is ordinary press-to-talk. Default `'push'`.handsFreeCaptureHandsFreeCaptureFactory | nullNoThe hands-free microphone, `createHandsFreeCapture` from `@happyvertical/smrt-ui/forms/hands-free`.handsFreeVadHandsFreeVadOptionsNoPause length and sensitivity for hands-free (see `HandsFreeVadOptions`).sendOnPausebooleanNoHands-free only: send the message once the speaker has been quiet for `sendOnPauseMs` after the last sentence was written down (the same path as pressing Send). A new sentence, a key press, Escape or the microphone button cancels the pending send. Never sends an empty message. While a send is in flight, or the composer is disabled, the send waits and the text stays in the box until the composer can accept it again. Default `false`.sendOnPauseMsnumberNoQuiet time before `sendOnPause` sends, in ms. Default 1200.speakingbooleanNoThe assistant's reply is being played aloud (text to speech). While `true`, hands-free listening is suspended (half-duplex: the microphone stays open but nothing is heard, so the assistant is not transcribed into the box) and resumes after a short guard when it turns `false`. The microphone shows "Paused while the assistant speaks". A pending send on pause is unaffected; tapping the microphone still ends hands-free. Default `false`.Bindable state
This component has no bindable public state.
Callback events
onsend(content: string, attachments: AssistantAttachmentRef[]) => void | Promise<void>onupload(files: FileList) => Promise<AssistantAttachmentRef[]>