Frontend Redesign Sandbox
Relevant source files
The following files were used as context for generating this wiki page:
The Frontend Redesign Sandbox is a production-ready scaffold designed to modernize the application's chat interface into a premium, tier-1 AI experience similar to platforms like ChatGPT, Claude, and Gemini. It introduces a high-fidelity workspace featuring a responsive two-pane layout, resizable canvas panels for document previews, and a unified rendering pipeline for complex AI responses including citations and code blocks.
Sources: redesign/INTEGRATION_GUIDE.md:3-8, specs/chat-ui-ux-premiumization/SPEC.md:3-15
Architecture and Layout Structure
The redesign transitions from a basic chat log view to a sophisticated three-zone workspace. The primary layout is a two-pane system where the main chat area occupies roughly 2/3 of the width, complemented by a resizable, collapsible "Canvas" panel on the right.
Core Components
The sandbox is organized into several functional modules:
- Chat Zone: Contains
ChatMessages,MessageBubble, and a premiumChatInput(Composer). - Canvas Zone: A side-pane for
DocumentPreviewandCodeViewerwith aResizableHandle. - Shared Layer: Includes
MessageContentfor Markdown rendering andSourceCitationfor high-fidelity evidence linking.
Sources: redesign/INTEGRATION_GUIDE.md:11-20, redesign/README_CHAT_REDESIGN.md:12-28, specs/chat-ui-ux-premiumization/SPEC.md:104-110
Visual Workspace Layout
The following diagram illustrates the relationship between the major UI zones:
The design utilizes a neutral palette with CSS variables for light/dark mode and a max-w-[760px] constraint for the central prose column to improve readability.
Sources: redesign/INTEGRATION_GUIDE.md:12-24, specs/chat-ui-ux-premiumization/SPEC.md:79-84
Data Flow and State Management
The redesign utilizes a normalized Zustand store to manage chat sessions and canvas states. This approach isolates streaming updates to specific message IDs, preventing unnecessary re-renders of the entire message history.
Normalized Store Structure
| Entity | Type | Description |
|---|---|---|
messageIds | string[] | Ordered list of message identifiers. |
messagesById | Record<string, Message> | Map of message entities for granular updates. |
canvas | CanvasState | Stores collapse state, width, and active source. |
activeSessionId | string | Tracks the currently viewed chat session. |
Sources: redesign/INTEGRATION_GUIDE.md:40-45, specs/chat-ui-ux-premiumization/SPEC.md:52-62
Message Streaming Sequence
Responses flow from the backend via Server-Sent Events (SSE). The frontend accumulates chunks in the normalized store until a [DONE] signal is received.
Enhanced Chat Features
Citation and Evidence System
The redesign supports multiple citation namespaces, allowing the assistant to link to different knowledge bases simultaneously.
- [S#]: Document sources (RAG retrieval).
- [M#]: Memory records (User context).
- [W#]: Wiki claims (Compiled knowledge).
- [K#]: KMS entries (Knowledge Management System).
Citations are rendered as clickable chips that automatically open the Right Canvas to the corresponding source. Uncited sources are hidden by default to reduce noise.
Sources: specs/wire-wiki-chat/SPEC.md:104-108, specs/kms-content-search-rag/SPEC.md:52-62
Advanced Rendering Capabilities
The unified rendering pipeline integrates react-markdown with Shiki for syntax highlighting and remark-gfm for GitHub Flavored Markdown support (tables, checklists, etc.).
- Code Blocks: Features copy-to-clipboard buttons and language labels.
- Live Editing: The
DocumentPreviewsimulates live updates by morphing content to the final version as data streams in. - Typing Cursor: A visual caret appears at the end of active assistant responses.
Sources: redesign/INTEGRATION_GUIDE.md:28-32, specs/chat-ui-ux-premiumization/SPEC.md:68-77
Implementation and Integration Guide
Migrating to the redesigned sandbox involves several technical steps to connect the existing backend to the new frontend logic.
Technical Requirements
The scaffold requires a specific SSE response format from the backend to populate the UI zones correctly:
data: {"type":"chunk","content":"..."}
data: {"type":"sources","sources":[...]}
data: {"type":"wiki_used","wiki_used":[...]}
data: [DONE]
Sources: redesign/INTEGRATION_GUIDE.md:66-72, specs/wire-wiki-chat/SPEC.md:92-95
Configuration Options
| Setting | Component | Default | Description |
|---|---|---|---|
canvas.width | useChatStore | Persistent | Stores the user's preferred sidebar width. |
theme | ThemeProvider | system | Supports light/dark/system theme switching. |
max_file_size_mb | Composer | 50 MB | Enforced upload limit for file attachments. |
Sources: redesign/INTEGRATION_GUIDE.md:14-15, 43, specs/pr5-pr6-frontend-cleanup/SPEC.md:43
Conclusion
The Frontend Redesign Sandbox provides a comprehensive framework for upgrading the application to a high-performance, visually polished AI workspace. By leveraging a normalized state management system and a two-pane layout, it enables complex interactions with document evidence while maintaining responsive streaming performance. Implementation requires aligning backend SSE outputs with the structured event types defined in the redesign's API layer.
Sources: redesign/INTEGRATION_GUIDE.md:113-125, specs/chat-ui-ux-premiumization/SPEC.md:33-40