APP_URL. No additional configuration needed.
Features
The web interface provides a rich chat experience with the following capabilities:Real-time Streaming Responses
AI responses stream in real-time via the Vercel AI SDK. The system uses the AI SDK’sUIMessage format with Server-Sent Events (SSE) to deliver token-by-token streaming.
/stream/chat and is implemented in lib/chat/api.js.
File Uploads
Send images, PDFs, and text files for the AI to process. The chat input supports drag-and-drop and clipboard paste. Supported file types:- Images: JPEG, PNG, GIF, WebP
- Documents: PDF
- Text files: Plain text, Markdown, CSV, JSON, HTML, CSS, JavaScript, TypeScript, Python, and more
- Images and PDFs → Passed as visual attachments to the LLM
- Text files → Base64 decoded and inlined into the message text
lib/chat/components/chat-input.jsx.
Chat History
Browse past conversations grouped by date. The sidebar displays all chats sorted by most recent activity.- Resume any chat by clicking on it
- Star important conversations for quick access
- Delete individual chats or clear all history
- Rename chats with custom titles
Job Management
Create and monitor agent jobs from the Swarm page. The interface shows:- Active jobs with real-time status updates
- Completed jobs with success/failure indicators
- Job logs for debugging
- Ability to trigger new jobs manually
Notifications
Receive job completion alerts with unread badges. The notification system:- Displays a badge count of unread notifications
- Shows notification details in a dedicated page
- Marks notifications as read when viewed
- Persists to the database for reliability
API Key Management
Generate and manage API keys from the Settings page. Users can:- Create a new API key (replaces any existing key)
- View the API key once immediately after creation
- Delete the API key when no longer needed
Authentication
The web interface uses NextAuth v5 (Auth.js) with a Credentials provider for email/password authentication.First-Time Setup
On first visit, the system automatically creates an admin account. The setup flow:- User visits the app URL
- System checks if any users exist in the database
- If
userCount === 0, displays account creation form - User creates email/password credentials
- Session cookie is issued
Session Management
Sessions are stored as JWT tokens in httpOnly cookies. TherequireAuth() helper validates sessions in Server Actions:
Environment Variables
Auth requires theAUTH_SECRET environment variable for session encryption. Generate one with:
Implementation Details
Route Structure
The web interface follows Next.js App Router conventions:- Main chat page:
app/page.jsx→ loadsChatPagecomponent - Streaming endpoint:
app/stream/chat/route.js→ importslib/chat/api.js - Auth routes:
app/api/auth/[...nextauth]/route.js→ importslib/auth/index.js
Component Architecture
The chat UI is built with React Server Components and Client Components:ChatPage(lib/chat/components/chat-page.jsx) — Top-level page wrapperChat(lib/chat/components/chat.jsx) — Main chat interface with message listChatInput(lib/chat/components/chat-input.jsx) — Input field with file uploadMessage(lib/chat/components/message.jsx) — Individual message renderingAppSidebar(lib/chat/components/app-sidebar.jsx) — Navigation sidebar
'use server' functions) with session authentication, never direct API calls.
Database Schema
Chats and messages are stored in SQLite via Drizzle ORM:Security Model
The web interface enforces security at multiple layers:- Session cookies — httpOnly, signed with
AUTH_SECRET - Server Actions — All data mutations go through
requireAuth()checks - Route handlers — Streaming endpoint validates session via
auth() - Database queries — Row-level ownership checks (user ID or ‘telegram’)
Customization
Customize the web interface appearance viatheme.css in your project root. This file is loaded after the managed app/globals.css and overrides default styles.
init — user customizations should go in theme.css only.
Voice Input (Optional)
The chat input includes optional voice recording powered by OpenAI Whisper. Enable with:OPENAI_API_KEY for transcription. The audio stream is sent to the server, transcribed, and the resulting text is streamed character-by-character into the input field.
Related Resources
Telegram Integration
Add Telegram bot for mobile chat access
Adding Channels
Build custom channel adapters