SAM-Web
May 1, 2026 ยท View on GitHub
Modern Web Interface for SAM (Synthetic Autonomic Mind)
A feature-complete web interface for SAM that provides full functionality through SAM's REST API.
Features
๐ฌ Complete Chat Interface
- 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
๐ค Multi-Provider AI Support
- 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
๐๏ธ Advanced Configuration
- 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
๐ Conversation Management
- Create, save, load, and delete conversations
- Export conversations (JSON, Markdown, Plain Text, PDF)
- Search and filter conversations
- Folder organization
- Conversation settings persistence
๐จ Modern UX
- 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)
Quick Start
Prerequisites
- 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
Installation
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 :8000
Then 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
First-Time Setup
- Open SAM-Web in your browser
- Enter your SAM API token from Preferences
- Click "Connect to SAM"
- Start chatting!
Project Structure
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
Architecture
Technology Stack
- 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
Design Principles
- 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
API Integration
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
Development
Local Development
-
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
Code Style
- JavaScript: ES6+, no transpilation
- CSS: Custom properties for theming, no preprocessor
- HTML: Semantic HTML5, accessible markup
- Formatting: 4-space indentation, semicolons required
Troubleshooting
"Failed to connect to SAM"
- Verify SAM is running
- Check API server is enabled in SAM Preferences
- Confirm API token is correct
- Check firewall/network settings for port 8080
"CORS errors in browser console"
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
"Models not loading"
- Verify models are installed in SAM
- Check model provider is configured
- Refresh the page to reload model list
Contributing
Contributions welcome! Please:
- Follow the code style guide
- Add tests for new features
- Update documentation
- Submit pull request with clear description
Part of the Ecosystem
SAM-Web is part of Synthetic Autonomic Mind - a family of open source AI tools:
- SAM - Native macOS AI assistant. SAM-Web connects to SAM's API server.
- CLIO - AI code assistant for the terminal. Runs on macOS and Linux.
- ALICE - GPU-accelerated image generation server with web interface and OpenAI-compatible API
License
SAM-Web is part of SAM and licensed under the GNU General Public License v3.0.
See LICENSE for full details.
Support
- Documentation: SAM Docs
- Issues: GitHub Issues
- Discussions: GitHub Discussions