AI chat interface: streaming replies with a caret, shimmering “thinking” state, safe Markdown rendering (lists, bold, code with a copy button), auto-growing composer with attachments, model picker, suggestions, stop / regenerate, and auto-scroll that yields to the user.
Response source. Default: local simulation (canned English replies, no network). Honor signal for stopping.
messages
{ role, content, files? }[]
Reads/writes the history. Also settable via a child <script type="application/json">.
busy
boolean
Read-only: a response is in progress.
strings
Partial<Record<string, string>>
Overrides for the default text (en-US): conversation (log label, {label} placeholder), jumpToLatest (jump button), send / sendTitle and stop / stopTitle (send button label and tooltip), attachments (attachment list label), removeFile (chip remove button, {name}), sizeBytes / sizeKB / sizeMB (file size, {n}), code (caption of a fence without a language), copyCode, copyResponse, responseActions (action bar label), regenerate / regenerateTitle (regenerate button label and tooltip), stopped (stopped notice, also announced), error (reply shown when the responder fails), announceWriting ({label}), announceResponse ({label}, {text}), codeBlock (stands for code in that announcement), announceCopied. App-wide translations: setStrings() from core/i18n.js, under the key "ai-chat". Can be set before the element is defined.
Methods
Name
Description
send(text)
Sends a message (with pending attachments) and generates the response.
stop()
Stops generating (also Escape in the field, or the send button while it reads Stop).
Export: lightweight, safe Markdown rendering (textContent only). partial: the source may end mid-token (streaming or stopped), so a dangling ** or backtick closes or hides and an open fence stays a code block. The chat uses it while streaming and for a stopped reply.
Events
Name
Description
mv-send
Cancelable. detail: { content, files }.
mv-response
Response finished. detail: { content, stopped }.
mv-stop / mv-reset / mv-error
Stop, reset, responder error (detail.error).
Content structure
Name
Description
.mv-ai-chat-header
Free-form header; [data-ai-chat-model-label] shows the selected model, [data-ai-chat-reset] clears the conversation.
.mv-ai-chat-empty
Empty state (hidden after the first message); any [data-prompt] sends its text.
form.mv-ai-chat-composer
Composer: textarea (Enter sends, Shift + Enter = new line), input[type=file], ul.mv-ai-chat-attachments, [data-ai-chat-send] button with two icons (send / stop).
Attachment, file button, hint, model trigger and model description.
CSS variables
Name
Default
Description
--mv-ai-chat-max-width
46rem
Reading width of the thread and composer.
--mv-ai-chat-user-bg
Background of the user’s bubbles.
Accessibility
Thread with role=log (aria-busy while generating); each message is a named <article> (“You” / assistant name). Streaming isn’t read word by word: a role=status region announces “… is writing a reply”, then the final response (code is summarized). Send button: label toggles between Send / Stop. Focusable code blocks (horizontal scrolling by keyboard), named Copy / Regenerate buttons. Reduced motion: no typing animation or blinking caret.