Modern Web Interface for SAM (Synthetic Autonomic Mind)
A feature-complete web interface for SAM that provides full functionality through SAM's REST API.
- Real-time streaming responses via Server-Sent Events
- Message history with Markdown rendering
- Code syntax highlighting
- Tool execution with interactive approval
- Image attachments and generation
- Cloud: OpenAI, Anthropic, GitHub Copilot, Google Gemini, DeepSeek
- Local: GGUF models (llama.cpp), MLX models (Apple Silicon)
- Automatic model detection and listing
- Provider-specific features and settings
- System Prompts: Full personality/prompt selection
- Mini-Prompts: Quick context injection with management UI
- Shared Topics: Share context between conversations
- Folders: Organize conversations
- Parameters: Temperature, top_p, max tokens, context window
- Tools: Enable/disable specific tool categories
- Create, save, load, and delete conversations
- Export conversations (JSON, Markdown, Plain Text, PDF)
- Search and filter conversations
- Folder organization
- Conversation settings persistence
- Responsive design (desktop, tablet, mobile)
- Dark/light theme with system preference detection
- Offline-first architecture
- No external dependencies or CDNs
- Accessible (WCAG 2.1 AA compliant)
- SAM must be running with API server enabled
- Download SAM: GitHub Releases
- Enable API in SAM Preferences β API Server
- Get your API token from SAM Preferences β API Server
- (Optional) Enable "Allow Remote Access" for network access
Option 1: Standalone Server
Clone this repository and serve it:
git clone https://github.com/SyntheticAutonomicMind/sam-web.git
cd sam-web
# Using Python
python3 -m http.server 8000
# Using Node.js
npx http-server -p 8000 --cors
# Using Caddy
caddy file-server --listen :8000Then open http://localhost:8000
Option 2: Embedded in SAM
SAM can serve SAM-Web directly. Copy this directory to SAM's resources and access at:
http://localhost:8080/web
- Open SAM-Web in your browser
- Enter your SAM API token from Preferences
- Click "Connect to SAM"
- Start chatting!
sam-web/
βββ README.md # This file
βββ index.html # Main chat interface (SPA)
βββ login.html # Token authentication page
βββ css/
β βββ style.css # Core design system
β βββ chat.css # Chat interface styles
β βββ chat-header.css # Chat header and metadata
β βββ sidebar.css # Conversation sidebar
β βββ prompt-sidebar.css # Prompts sidebar
β βββ components.css # Reusable UI components
β βββ toolbar.css # Parameters toolbar
β βββ folders.css # Folder management
β βββ code-blocks.css # Code syntax highlighting
β βββ markdown-content.css # Markdown rendering
β βββ markdown-toolcards.css # Tool execution cards
β βββ highlight-theme.css # Code highlighting theme
βββ js/
β βββ api.js # SAM API client
β βββ conversations.js # Conversation management
β βββ prompts.js # System and mini-prompts
β βββ personalities.js # Personality selection
β βββ parameters.js # Model parameters
β βββ folders.js # Folder management
β βββ shared-topics.js # Shared topic management
β βββ utils/
β βββ markdown.js # Markdown rendering
β βββ toast.js # Toast notifications
β βββ highlight.min.js # Syntax highlighting
βββ .gitignore
- Frontend: Pure HTML5, CSS3, Vanilla JavaScript (ES6+)
- API: SAM REST API (OpenAI-compatible + extensions)
- Authentication: Bearer token authentication
- Streaming: Server-Sent Events (SSE) for real-time responses
- Storage: LocalStorage for settings, SessionStorage for state
- No Build Step - Pure web standards, no bundler required
- Zero Dependencies - No npm packages, all assets self-hosted
- Offline First - Works without internet connection
- Progressive Enhancement - Degrades gracefully without JavaScript
- Accessibility - WCAG 2.1 AA compliant, keyboard navigable
- Performance - Lazy loading, minimal DOM updates, optimized rendering
SAM-Web communicates with SAM via REST API:
- Base URL:
http://localhost:8080(or custom port) - Authentication:
Authorization: Bearer YOUR_TOKEN - Streaming: SSE endpoint for real-time chat responses
- Endpoints: Full SAM API including custom extensions
-
Clone the repository:
git clone https://github.com/SyntheticAutonomicMind/sam-web.git cd sam-web -
Start a local server (any HTTP server works):
python3 -m http.server 8000
-
Open http://localhost:8000 in your browser
-
Connect to running SAM instance
- JavaScript: ES6+, no transpilation
- CSS: Custom properties for theming, no preprocessor
- HTML: Semantic HTML5, accessible markup
- Formatting: 4-space indentation, semicolons required
- Verify SAM is running
- Check API server is enabled in SAM Preferences
- Confirm API token is correct
- Check firewall/network settings for port 8080
SAM includes CORS headers by default. If using custom setup:
- Ensure SAM API server allows your origin
- Check browser security settings
- Try running SAM-Web from same origin as SAM
- Verify models are installed in SAM
- Check model provider is configured
- Refresh the page to reload model list
Contributions welcome! Please:
- Follow the code style guide
- Add tests for new features
- Update documentation
- Submit pull request with clear description
SAM-Web is part of SAM and licensed under the GNU General Public License v3.0.
See LICENSE for full details.
- Documentation: SAM Docs
- Issues: GitHub Issues
- Discussions: GitHub Discussions