Skip to main content
Reusable web UI components for building AI chat interfaces powered by @mariozechner/pi-ai and @mariozechner/pi-agent-core. Built with mini-lit web components and Tailwind CSS v4.

Features

  • Chat UI: Complete interface with message history, streaming, and tool execution
  • Tools: JavaScript REPL, document extraction, and artifacts (HTML, SVG, Markdown, etc.)
  • Attachments: PDF, DOCX, XLSX, PPTX, images with preview and text extraction
  • Artifacts: Interactive HTML, SVG, Markdown with sandboxed execution
  • Storage: IndexedDB-backed storage for sessions, API keys, and settings
  • CORS Proxy: Automatic proxy handling for browser environments
  • Custom Providers: Support for Ollama, LM Studio, vLLM, and OpenAI-compatible APIs

Installation

Quick Start

Architecture

The web UI follows a layered architecture:

Core Components

ChatPanel

High-level chat interface with built-in artifacts panel.

AgentInterface

Lower-level chat interface for custom layouts.
Properties:
  • session: Agent instance
  • enableAttachments: Show attachment button (default: true)
  • enableModelSelector: Show model selector (default: true)
  • enableThinkingSelector: Show thinking level selector (default: true)
  • showThemeToggle: Show theme toggle (default: false)

Storage System

Setup

Using Stores

SettingsStore - Key-value settings:
ProviderKeysStore - API keys by provider:
SessionsStore - Chat sessions with metadata:

Tools

JavaScript REPL

Execute JavaScript in a sandboxed browser environment:

Extract Document

Extract text from documents at URLs:

Artifacts Tool

Built into ArtifactsPanel, supports: HTML, SVG, Markdown, text, JSON, images, PDF, DOCX, XLSX.

Attachments

Load and process files:
Attachment structure:
Supported formats: PDF, DOCX, XLSX, PPTX, images, text files.

Dialogs

SettingsDialog

SessionListDialog

ApiKeyPromptDialog

ModelSelector

CORS Proxy

For browser environments with CORS restrictions:
Providers requiring proxy:
  • zai: always
  • anthropic: only OAuth tokens (sk-ant-oat-*)

Styling

Import the pre-built CSS:
Or use Tailwind with custom config:

Examples

See the example directory for a complete web app with:
  • Session management
  • Custom message types
  • Artifact panel integration
  • Storage setup
  • Dialog usage

License

MIT