Skip to content

Frontend Reference

The Vue 3 frontend lives in src/. It uses the Composition API exclusively and communicates with the Rust backend via @tauri-apps/api/core invoke() calls and @tauri-apps/api/event listeners.

Pinia Stores (src/stores/)

StoreFileManages
chatchat.tsConversations, messages, streaming state, draft
modelsmodels.tsLocal models, pull progress, model user data
hostshosts.tsHost list, health status, active host
settingssettings.tsKV settings, generation defaults
authauth.tsAuthentication state, sign-in flow

Key Composables (src/composables/)

ComposablePurpose
useStreaming.tsAccumulates streaming tokens into reactive state
useStreamingEvents.tsRegisters Tauri event listeners for all chat:* events
useSendMessage.tsOrchestrates message send flow (validate, invoke, stream)
useConversationLifecycle.tsNew conversation creation, switching, deletion
useAppOrchestration.tsTop-level app startup and teardown
useDraftManager.tsPer-conversation draft persistence (settings, input text)
useContextWindow.tsFolder context attach/detach, token counting
useAttachments.tsImage/file attachment handling
useAutoScroll.tsChat auto-scroll with manual override detection
useKeyboard.tsGlobal keyboard shortcut registration
useTheme.tsDark/light mode toggle and persistence
useModelLibrary.tsOllama library search and tag fetching

Tauri Event Catalog

All events emitted from the Rust backend and listened to in the frontend:

EventPayloadListener
chat:token{ conversation_id, content }useStreamingEvents.ts
chat:thinking-start{ conversation_id }useStreamingEvents.ts
chat:thinking-token{ conversation_id, content }useStreamingEvents.ts
chat:thinking-end{ conversation_id }useStreamingEvents.ts
chat:done{ conversation_id, tokens_per_sec? }useStreamingEvents.ts
chat:error{ conversation_id, error }useStreamingEvents.ts
chat:tool-call{ conversation_id, tool_name, arguments }useStreamingEvents.ts
chat:tool-result{ conversation_id, tool_name, result }useStreamingEvents.ts
model:pull-progress{ model, status, percent? }stores/models.ts
model:pull-done{ model }stores/models.ts
host:status-change{ host_id, status, latency_ms? }stores/hosts.ts

Markdown Pipeline (src/lib/markdown.ts)

Messages are rendered through: markdown-it (CommonMark + GFM) → Shiki (syntax highlighting, async, preloaded after mount) → KaTeX (LaTeX math via $...$ and $$...$$).

Shiki is preloaded asynchronously after first mount to avoid blocking first render.

Released under the MIT License.