Skip to main content

Crate dioxus_genai_chat

Crate dioxus_genai_chat 

Source
Expand description

A configurable Dioxus + Bulma chat UI.

The crate provides a ChatSurface component plus a small data model (ChatTranscript, ChatMessage, ChatMessagePayload) for rendering chat conversations, including:

  • chained, collapsible reasoning timelines (Reasoning),
  • inline message controls — buttons, selectors, toggles (InlineControl), surfaced through ChatSurface’s on_action handler,
  • spinning status indicators, tool calls, progress, and errors.

The composer is controlled: bind ChatSurfaceProps::input and handle on_send/on_stop/on_retry/on_clear. Set ChatSurfaceProps::embedded to host the surface inside an app that already provides Bulma and a theme, and inject app-specific composer controls via ChatSurfaceProps::input_accessory.

With the default genai feature enabled, ChatTranscript::to_genai_request converts a transcript into a genai chat request. Disable default features to build for wasm32-unknown-unknown (the web target), where genai is not available. The markdown feature (on by default, pure Rust) renders ChatMessagePayload::Markdown to HTML.

Structs§

ChatControls
ChatMessage
ChatSurfaceProps
ChatTranscript
ContextItem
A piece of context (a file or directory) attached to the next message.
ControlEvent
Emitted when the user interacts with an InlineControl.
DiffLine
A single line within a unified FileDiff.
Document
A document shown as a thumbnail that expands to a full view on click.
FileDiff
A unified diff for a single file, rendered with an apply animation.
ProgressState
Reasoning
A collapsible group of chained reasoning steps shown as a connected timeline.
ReasoningStep
A single phase in a chained “thinking” trace (à la VS Code agent steps).
SelectOption
An option in an inline InlineControl::Select.
ToolCall

Enums§

ChatMessagePayload
ChatRole
ContextEvent
Emitted when the user adds or removes context via the input area.
ContextKind
Whether a piece of attached context is a file or a directory.
ControlStyle
Visual emphasis for an inline control.
ControlValue
The kind of interaction that produced a ControlEvent.
DiffKind
The role of a single line in a FileDiff.
DocumentEvent
Emitted when the user acts on documents in a gallery.
DocumentKind
The type of a Document, used to pick an icon when there is no image preview.
InlineControl
A small interactive element rendered inline inside a message.
StepStatus
Lifecycle of a single step inside a chained reasoning trace.
ToolCallStatus

Functions§

ChatSurface
sample_transcript