Skip to content
Back

AI chatPro

A full AI chat block: a user turn, the assistant thinking, searching and streaming a cited answer, then actions.

oxyn add ai-chat
You14:02

Why does auth.rs fail at the minute boundary?

Atlas14:02
Thinking
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • The transcript is where the user reads what the agent did and decides what to do next.
  • In an agent app it is not a chat log: one user message can produce minutes of interleaved reasoning, tool rows, approvals, partial answers and a final answer, and the user will scroll back through hours of it, copy code out of it, branch it, and grade it.
  • Every product we studied converges on the same pieces — message action bars, "Thought for Ns" reasoning, inline citations, follow-up chips, edit-to-branch arrows, auto-scroll with a "jump to latest" button — and the free agent layer is commoditised across 6–12 React kits (note 01).
  • What none of them gives a Rust app is the agent-shaped transcript: turns that hold a whole run, a scroller that never fights the reader while tokens stream, and every part driven by the same AgentState.

When not to use

  • The prompt box for an agent, in six layouts: use Composer instead.
  • Streamed text arriving: use Text Reveal instead.
  • Grey shapes the size of what they stand in for, one sheen sweeping across all of them in step (or a staggered pulse), shown only after a short delay, then a crossfade into the content: use Skeleton instead.

Installation

AI chat is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add ai-chat

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Full

Reasoning, sources and a streamed answer.

You14:02

Why does auth.rs fail at the minute boundary?

Atlas14:02
Thinking
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Plain

Just the answer.

You14:02

Why does auth.rs fail at the minute boundary?

Atlas14:02
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Done

Finished.

You14:02

Why does auth.rs fail at the minute boundary?

Atlas14:02
Thought for 3 seconds
3 sources · 1.2s

The test fails when a token is minted in the last second of a minute: exp is checked a few milliseconds later and the strict comparison rejects it .

Fix: add a small leeway to the expiry check, as the crate supports :

Source codeRust
let mut v = Validation::new(Algorithm::RS256);
v.leeway = 30; // seconds

This matches the issue reported in #482 .

1.2k tokens · 4.1s
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

AiChat

PropTypeDefaultDescription
elapsed_msu64u64::MAXms since the reply started.
reasoningbooltrueShow the reasoning block.
sourcesbooltrueShow sources.
heightf32520.0Height px.
childrenElementDefault::default()Composer (rendered under the log).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabThrough the transcript to the composer

Accessibility

  • The transcript is a polite log; each turn is an article.
From the spec
  • Transcript: role="feed" (WAI-ARIA feed pattern) with aria-busy="true" while a page loads; each message is role="article" with aria-labelledby = author + time ("Agent, 14:02") and aria-posinset / aria-setsize (set size = -1 when unknown). No aria-live on the transcript (a role="log" would read tokens aloud — rejected).
  • Keyboard: PageDown / PageUp move focus between articles (feed pattern); [ / ] previous / next turn (proposed); within an article, Tab reaches links, code-block buttons, citations, then actions. Esc returns focus to the composer.
  • Announcements (via the composer's single polite live region): "Response complete" once per turn; "3 new messages" when detached (throttled 1 per 10 s); errors and "Needs your approval" assertive.
  • Focus never jumps because content arrived; streaming never steals focus from the composer.
  • Contrast: body text ≥ 4.5:1 on every bubble fill; muted system rows ≥ 4.5:1 (muted is a hue/ weight choice, not a contrast cut); the 60 % "unread" fade on mid-run messages keeps ≥ 4.5:1 by dimming the fill, not the text (proposed).
  • Reduced motion: §6 table; scrolls instant.
  • Zoom 200 %: bubbles reflow, max-width becomes 100 %; no horizontal page scroll (code blocks scroll internally).

Motion & interaction

  • New user message: arrives via the composer's fly-up (≤ 260 ms, composer.md §4); the transcript reserves its final height in the same frame so nothing jumps.
  • Agent message appears: the status line / thinking row occupies the agent slot first (loaders.md §3.3 show_delay 300 ms); first content replaces it in place (no slide).
  • System / event row: fades in with a 4 px rise, 180 ms.
  • Hover: message footer actions fade from 0 → 100 % (desktop); timestamp appears in the header. Touch surfaces show actions persistently on the last agent turn and on long-press for others (pattern "hover on desktop, persistent on mobile", note 04 §2g).
  • Jump pill: slides up 8 px + fade (160 ms ease.out); count rolls with dur.digit.roll; on click the pill shrinks to 0.9 and fades as the scroll begins.
  • Deep-link flash: target block background tints with color.highlight at 24 % alpha, holds 600 ms, fades 900 ms.
  • Day separator: sticky header crossfades between days (120 ms) rather than pushing.

Family-E motion tokens (proposed; shared tokens keep their composer.md values)

TokenValueUsed for
dur.actions.reveal120 ms fade, 80 ms hover intent delayfooter actions on hover / focus
dur.actions.hide160 ms, 300 ms after pointer leavesfooter actions hide
dur.copy.confirm1500 ms hold, then 160 ms revertcopy → ✓
dur.collapse200 ms (grid-rows 0fr ↔ 1fr style height spring)reasoning, long output, sources expand / collapse (Claude desktop expand .2 s, note 08)
delay.preview.open / .close300 ms / 150 ms gracecitation hover cards, timestamp tooltips
dur.version.swap180 ms crossfade + height spring.snapbranch ‹ 2/3 › switch
dur.row.enter180 ms, y +4 → 0system rows, source cards, chips
stagger.chips40 ms, cap 5follow-ups, starter prompts, source cards
highlight.flash600 ms hold + 900 ms fadedeep links, search hits, citation targets
Reduced motionall of the above → 0–80 ms opacity crossfades; heights snap; no stagger; scrolls instant; the copy ✓ still holds 1500 ms (it carries meaning)—

Responsive behaviour

  • Fills its container up to 760 px.
Edge cases (spec)
  • Very long threads (10 000+ messages, 100 MB text): block virtualisation (§4.1); history paged in 50-turn pages (proposed); search runs on the store.
  • Very long single turns (hour-long runs): older blocks inside the turn virtualise; the turn header ("Turn 7 · Worked for 1h 02m") becomes sticky while the turn is in view (proposed).
  • Very fast agent: answer completes before the status row's 300 ms show_delay — the row never shows; footer actions fade in after Done.
  • Very slow agent: status row and loaders handle liveness; transcript only follows.
  • Out-of-order / late events (a tool result arriving after the next prose block): blocks are ordered by the adapter's sequence id, not arrival time; a late block inserts in place and the anchor rule compensates if above the viewport.
  • Edits of earlier messages while a run is active: see message-bubble §edit (stop-then-branch).
  • RTL: chat layout mirrors (user bubbles on the left); code, numbers, diff stats stay LTR in bidi isolates; the jump pill stays centred.
  • Tiny / dense: transcript/ide-panel at 280 px: avatars and headers off, actions in a ⋯ menu.
  • Touch: long-press a message → action sheet; swipe-right on a user message = quote/reply (Pro).
  • Slow networks / offline: cached pages render; uncached older pages show "Offline · Earlier messages unavailable"; sends queue in the composer (composer edge cases).
  • Mixed content heights (images arriving late): images reserve aspect-ratio boxes from metadata; unknown ratio = 16:9 at 40 % column width (same rule as text-reveal §5) and the anchor compensates.

Notes for AI

  • Import AiChat from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • There is no GPUI version yet; use the Dioxus component.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI