Appearance
Function: Chat()
ts
function Chat(props: UiChatProps): Block;Defined in: packages/sdk/src/renderer/blocks/index.ts:2898
Experimental
Chat — a richly-augmented chat surface driven by a messages array in session state. Every user turn (appended by a PromptInput/Suggestion bound to the same name via pushTo) triggers an assistant reply, streamed token-by-token from Chrome's built-in LanguageModel (provider: 'chrome-ai', the default) or produced by a caller-supplied generate callback (API mode). A Node-side augment callback can decorate each turn with rich blocks (reasoning, tool calls, sources, confirmations, images, code…). LocalChat is this same block with the provider fixed to Chrome.
Parameters
| Parameter | Type |
|---|---|
props | UiChatProps |
Returns
Example
ts
Chat({
name: 'messages',
systemPrompt: 'You are a concise assistant.',
augment: ({text}) =>
/delete/i.test(text)
? {confirmation: {message: 'Delete the file?'}}
: null,
onFeedback: ({kind}) => console.log('feedback', kind),
});