Chat Interface & State
Relevant source files
The following files were used as context for generating this wiki page:
- README.md
- packages/conduit_core/test/fixtures/chat_blobs/01_minimal_new_chat.json
- packages/conduit_core/test/fixtures/chat_blobs/04_file_image_attachments.json
- packages/conduit_core/test/fixtures/chat_blobs/05_web_search_status_sources.json
- packages/conduit_core/test/fixtures/chat_blobs/06_code_executions.json
- packages/conduit_core/test/fixtures/chat_blobs/11_embeds.json
- assets/release_notes/en.json
Conduit provides a native mobile interface for interacting with various AI backends including Open WebUI, direct model endpoints (Ollama, OpenAI), and local Apple Intelligence models. The system manages chat state through a structured "chat blob" format that synchronizes between the local device and remote servers, supporting token-by-token streaming, multimodal attachments, and complex execution statuses.
Sources: README.md:1-50, packages/conduit_core/test/fixtures/chat_blobs/01_minimal_new_chat.json
Chat State Architecture
The application stores chat state in a comprehensive JSON structure referred to as a "blob". This blob contains the conversation history, metadata (envelopes), and extended features like code execution results or web search sources.
Chat Blob Schema
A chat object consists of several core components:
- Envelope: High-level metadata for indexing and listing (ID, title, folder, pinned status).
- History: A graph-based structure mapping message IDs to message objects, tracking the
currentIdof the active branch. - Messages: A linear array of message objects for legacy compatibility or rendering.
- Metadata: Lists of models used, parameters, and global file collections.
Sources: packages/conduit_core/test/fixtures/chat_blobs/01_minimal_new_chat.json:3-40, packages/conduit_core/test/fixtures/chat_blobs/04_file_image_attachments.json:3-15
The diagram shows the hierarchical relationship of components within a single chat state object.
Sources: packages/conduit_core/test/fixtures/chat_blobs/05_web_search_status_sources.json, packages/conduit_core/test/fixtures/chat_blobs/06_code_executions.json
Message Composition & Content
Messages in Conduit support multiple roles and rich content types. The system handles standard text, Markdown, LaTeX, and various status indicators.
Message Attributes
| Field | Type | Description |
|---|---|---|
id | UUID | Unique identifier for the message. |
role | String | user, assistant, or system. |
content | String | The actual message text, often containing Markdown or HTML. |
done | Boolean | Indicates if a streaming response is complete. |
timestamp | Integer | Epoch seconds for the message creation. |
parentId | UUID | ID of the preceding message in the conversation branch. |
Sources: packages/conduit_core/test/fixtures/chat_blobs/01_minimal_new_chat.json:20-35, packages/conduit_core/test/fixtures/chat_blobs/02_linear_multi_turn.json
Multimodal Attachments
Conduit supports images and files within message objects. Files are serialized with metadata including hashes and content summaries.
- User Uploads: Included in the
filesarray of a user message. - Assistant Generations: Generated images or processed files returned in assistant replies.
- Embeds: Assistant messages can carry an
embedsarray containing raw HTML or URLs for interactive charts.
Sources: packages/conduit_core/test/fixtures/chat_blobs/04_file_image_attachments.json:1-65, packages/conduit_core/test/fixtures/chat_blobs/11_embeds.json:1-15
Execution & Status Tracking
Assistant messages track internal model actions through statusHistory and code_executions fields. This allows the UI to render progress for long-running tasks like web searches or code interpretation.
Web Search Flow
When a model performs a web search, the state updates through multiple actions:
web_search_queries_generated: Lists the search terms.web_search: Records searched URLs and snippets.sources_retrieved: Finalizes the count of reference documents.
Sources: packages/conduit_core/test/fixtures/chat_blobs/05_web_search_status_sources.json:45-90
The flowchart illustrates the sequential status updates stored in the message state during a web-search turn.
Sources: packages/conduit_core/test/fixtures/chat_blobs/05_web_search_status_sources.json
Code Execution
The code_executions array stores the code snippet, language (e.g., Python), and the resulting output or generated files (e.g., charts stored in /cache/code/executions/).
Sources: packages/conduit_core/test/fixtures/chat_blobs/06_code_executions.json:45-75
User Interface & Controls
The interface supports advanced chat features such as branching, model comparison, and reasoning visibility.
- Reasoning Blocks: The app renders
<details type="reasoning">tags natively, showing the model's thought process with duration timers. - Branching: The state tracks
childrenIdsandcurrentBranchHintsto allow users to switch between different paths in the conversation. - Regenerated Answers: Users can switch between multiple model attempts for the same prompt using UI arrows that navigate the state's message graph.
Sources: README.md:120-150, assets/release_notes/en.json:4.1.9, packages/conduit_core/test/fixtures/chat_blobs/08_unknown_future_keys.json:45-60
Connection Types
The chat interface adapts its features based on the active backend:
- Open WebUI: Full features (tools, web search, folders).
- Direct: Model-specific endpoints (Ollama, OpenRouter).
- Apple On-Device: Local offline inference on iOS.
- Hermes: Agent-centric interaction with tool approval steps.
Sources: README.md:55-100
Conduit centralizes chat logic in a robust state blob that facilitates native rendering of AI artifacts. By managing hierarchical message history and detailed execution statuses, the system maintains consistency across diverse model backends and mobile platforms.