Assistant message

One reply from the on-device model: a trace of what it did, the answer streaming in, its sources, and copy or retry. Includes UserMessage for the person's turns.

No model needed

Install

npx ondai add assistant-message

Usage

import { AssistantMessage, UserMessage } from '@/components/ondai/assistant-message'

<UserMessage text={question} />
<AssistantMessage text={reply.text} status={reply.status} thoughtMs={reply.thoughtMs} steps={steps} sources={sources} onRetry={retry} />
  • The trace reads "Thought for 1.2s" from the time to the first word; tool steps fold under it.

Customize

Every AI component takes the same look and customization props, so it fits your app rather than ours.

<AssistantMessage
  variant="pop"
  tint="#FF5A5F"
  size="lg"
  radius={12}
  icons={{ avatar: Search, expand: null }}
  labels={{ thinking: '…', thought: '…' }}
/>
PropWhat it does
variantThe look of the whole component: clean, minimal, glass, pop, candy, metal, shine
sizesm, md, lg; type, rows, icons and keys scale together
tintAny colour; the variant paints its keys, tiles and glow in it
radiusCorner radius of the container
iconsReplace any icon (a lucide component, an element, or null to hide it): avatar, expand, collapse, stepDone, stepError, error, copy, copied, retry
labelsEvery visible and spoken string; defaults are exported as assistantMessageLabels: thinking, thought, stepsOne, stepsMany, error, refusal, copy, copied, retry
SlotsDraw a part yourself: renderSource, renderStep, renderActions, renderError
stylesStyle any named part

Variants

PropOptions
variantclean, minimal, glass, pop, candy, metal, shine
presentationplain, card
sizesm, md, lg

Fallback

When no provider is ready the component renders the unavailable state (AvailabilityGate copy) and, where a deterministic path exists, keeps working without the model.

Eval score

No model-driven fixtures for this component.

Files

Registry dependencies: button, shimmer-text, streaming-text, surface

npm dependencies: @ondai/tokens, expo-clipboard, lucide-react-native, react-native-reanimated

On this page