Web UI Module
The Web UI module provides Lit-based custom elements for chat interfaces, tool rendering, and artifacts.
It lives under indusagi/src/webui and is exported from indusagi/webui.
Main Entry Points
ChatPanel(pi-chat-panel)AgentInterface(agent-interface)
ChatPanel
File: webui/ChatPanel.ts
ChatPanel wires up the AgentInterface and ArtifactsPanel and handles mobile vs desktop layout.
Call setAgent(agent, config) to initialize the UI and optionally provide:
onApiKeyRequired(provider)onBeforeSend()onCostClick()sandboxUrlProvider()toolsFactory(agent, agentInterface, artifactsPanel, runtimeProvidersFactory)
It registers the artifacts tool renderer and sets agent tools automatically.
AgentInterface
File: webui/components/AgentInterface.ts
Key features:
- Displays messages, streaming content, and tool calls.
- Supports attachments, model selector, and thinking selector.
- Integrates with proxy settings for browser environments.
- Hooks for API key prompts, before-send callbacks, and tool call gating.
Public methods:
setInput(text, attachments)setAutoScroll(enabled)
Message Types
File: webui/components/Messages.ts
UserMessageandAssistantMessagerender core LLM messages.UserMessageWithAttachmentsextends user messages with attachments.ArtifactMessageis used for persistent artifact history.
Custom messages can be registered via declaration merging on CustomAgentMessages.
Streaming
StreamingMessageContainer shows the current streaming assistant message while the agent is running.
It is updated via AgentEvent subscriptions in AgentInterface.
Message Rendering
File: webui/components/message-renderer-registry.ts
You can register custom renderers per message role using:
registerMessageRenderer(role, renderer)renderMessage(message)
Next Docs
indusagi/docs/webui/components.mdindusagi/docs/webui/tools-and-artifacts.mdindusagi/docs/webui/sandbox.mdindusagi/docs/webui/storage-and-settings.mdindusagi/docs/webui/dialogs.mdindusagi/docs/webui/i18n-and-formatting.mdindusagi/docs/webui/styles.md
