|  | 
|  | 1 | +# Privatgespräch | 
|  | 2 | + | 
|  | 3 | +https://letmaik.github.io/privatgespräch/ | 
|  | 4 | + | 
|  | 5 | +A privacy-focused AI chat interface that runs language models entirely in your browser using WebGPU acceleration. Designed for desktop and laptop computers. | 
|  | 6 | + | 
|  | 7 | +## Privacy & Offline Operation | 
|  | 8 | + | 
|  | 9 | +- **Complete Privacy**: All AI processing happens locally in your browser - no data is ever sent to external servers | 
|  | 10 | +- **Offline Capable**: After initial model download, the application works completely offline | 
|  | 11 | +- **No Tracking**: No analytics, telemetry, or data collection of any kind | 
|  | 12 | +- **Local Storage**: Models and conversations stay on your device | 
|  | 13 | + | 
|  | 14 | +## Device Compatibility | 
|  | 15 | + | 
|  | 16 | +**Recommended**: Desktop and laptop computers with dedicated or integrated GPU | 
|  | 17 | +**Not Recommended**: Mobile phones or tablets (limited WebGPU support and performance) | 
|  | 18 | + | 
|  | 19 | +**For Mobile**: Consider [EnclaveAI](https://enclaveai.com) for privacy-focused mobile AI chat | 
|  | 20 | + | 
|  | 21 | +## Features | 
|  | 22 | + | 
|  | 23 | +- **Local Processing**: AI inference runs entirely in the browser | 
|  | 24 | +- **Multiple Models**: Support for Llama 3.2 1B, Phi-3.5 Mini, SmolLM2 1.7B, and Qwen3 0.6B | 
|  | 25 | +- **WebGPU Acceleration**: Hardware-accelerated inference using GPU | 
|  | 26 | +- **Syntax Highlighting**: Code blocks with full syntax highlighting | 
|  | 27 | +- **Copy Functionality**: Copy code snippets and full responses | 
|  | 28 | +- **Reasoning Support**: Collapsible thinking blocks for reasoning models | 
|  | 29 | + | 
|  | 30 | +## Technology Stack | 
|  | 31 | + | 
|  | 32 | +- **React 18**: UI framework with modern hooks | 
|  | 33 | +- **Vite**: Build tool and development server | 
|  | 34 | +- **Tailwind CSS**: Utility-first CSS framework | 
|  | 35 | +- **Transformers.js**: Browser-based transformer model execution | 
|  | 36 | +- **ONNX Runtime Web**: WebGPU-accelerated model runtime | 
|  | 37 | +- **react-markdown**: Markdown rendering | 
|  | 38 | +- **react-syntax-highlighter**: Code syntax highlighting | 
|  | 39 | + | 
|  | 40 | +## Requirements | 
|  | 41 | + | 
|  | 42 | +### Browser Compatibility | 
|  | 43 | +- WebGPU support (Chrome 113+, Edge 113+) | 
|  | 44 | +- Modern JavaScript (ES2020+) | 
|  | 45 | + | 
|  | 46 | +### System Requirements | 
|  | 47 | +- GPU with WebGPU support | 
|  | 48 | +- 4GB+ RAM recommended | 
|  | 49 | +- 2-3GB storage for model cache | 
|  | 50 | + | 
|  | 51 | +**Note**: This application is optimized for desktop and laptop computers. Mobile devices have limited WebGPU support and may not provide adequate performance. | 
|  | 52 | + | 
|  | 53 | +## Installation | 
|  | 54 | + | 
|  | 55 | +```bash | 
|  | 56 | +npm install | 
|  | 57 | +npm run dev | 
|  | 58 | +``` | 
|  | 59 | + | 
|  | 60 | +### Build | 
|  | 61 | + | 
|  | 62 | +```bash | 
|  | 63 | +npm run build | 
|  | 64 | +npm run preview | 
|  | 65 | +``` | 
|  | 66 | + | 
|  | 67 | +## Usage | 
|  | 68 | + | 
|  | 69 | +1. Open the application (default: `http://localhost:5173`) | 
|  | 70 | +2. Select a model from the dropdown | 
|  | 71 | +3. Wait for initial model download and loading | 
|  | 72 | +4. Start conversation by typing a message | 
|  | 73 | +5. **Go offline**: After initial setup, disconnect from internet - the app continues working | 
|  | 74 | + | 
|  | 75 | +**Privacy Note**: All conversations and AI processing remain on your device. No data leaves your computer. | 
|  | 76 | + | 
|  | 77 | +## Architecture | 
|  | 78 | + | 
|  | 79 | +### Frontend Structure | 
|  | 80 | +``` | 
|  | 81 | +src/ | 
|  | 82 | +├── App.jsx                 # Main application component | 
|  | 83 | +├── main.jsx               # React app entry point | 
|  | 84 | +├── worker.js              # Web Worker for AI processing | 
|  | 85 | +├── components/ | 
|  | 86 | +│   ├── Chat.jsx           # Chat interface with message rendering | 
|  | 87 | +│   ├── ModelSelector.jsx  # Model selection dropdown | 
|  | 88 | +│   ├── LoadingModal.jsx   # Model loading progress modal | 
|  | 89 | +│   ├── Progress.jsx       # Progress bar component | 
|  | 90 | +│   └── icons/             # Icon components | 
|  | 91 | +└── index.css              # Global styles | 
|  | 92 | +``` | 
|  | 93 | + | 
|  | 94 | +### Components | 
|  | 95 | + | 
|  | 96 | +- **Web Worker** (`worker.js`): Handles model loading and inference | 
|  | 97 | +- **Chat Component** (`Chat.jsx`): Message rendering with markdown support | 
|  | 98 | +- **Model Selector** (`ModelSelector.jsx`): Model selection interface | 
|  | 99 | +- **Think Blocks**: Collapsible reasoning blocks for compatible models | 
|  | 100 | + | 
|  | 101 | +### Supported Models | 
|  | 102 | + | 
|  | 103 | +| Model | Size | ID | Features | | 
|  | 104 | +|-------|------|----|---------|  | 
|  | 105 | +| Llama 3.2 1B | 1.2 GB | `onnx-community/Llama-3.2-1B-Instruct-q4f16` | General chat | | 
|  | 106 | +| Phi-3.5 Mini | 2.1 GB | `onnx-community/Phi-3.5-mini-instruct-onnx-web` | Code generation | | 
|  | 107 | +| SmolLM2 1.7B | 1.1 GB | `HuggingFaceTB/SmolLM2-1.7B-Instruct` | Efficient chat | | 
|  | 108 | +| Qwen3 0.6B | 0.5 GB | `onnx-community/Qwen3-0.6B-ONNX` | Reasoning support | | 
|  | 109 | + | 
|  | 110 | +## Configuration | 
|  | 111 | + | 
|  | 112 | +To add new models, update both `worker.js` and `ModelSelector.jsx`: | 
|  | 113 | + | 
|  | 114 | +```javascript | 
|  | 115 | +// worker.js - Add model configuration | 
|  | 116 | +static getModelConfig(model_id) { | 
|  | 117 | +  const configs = { | 
|  | 118 | +    "new-model-id": { | 
|  | 119 | +      dtype: "q4f16", | 
|  | 120 | +      device: "webgpu" | 
|  | 121 | +    } | 
|  | 122 | +  }; | 
|  | 123 | +} | 
|  | 124 | +``` | 
|  | 125 | + | 
|  | 126 | +```javascript | 
|  | 127 | +// ModelSelector.jsx - Add to AVAILABLE_MODELS | 
|  | 128 | +{ | 
|  | 129 | +  id: 'model-key', | 
|  | 130 | +  name: 'Model Name', | 
|  | 131 | +  description: 'Description and size', | 
|  | 132 | +  url: 'new-model-id', | 
|  | 133 | +  hasReasoningBlocks: false | 
|  | 134 | +} | 
|  | 135 | +``` | 
|  | 136 | + | 
|  | 137 | +## Troubleshooting | 
|  | 138 | + | 
|  | 139 | +### WebGPU Issues | 
|  | 140 | +- Use Chrome 113+ or Edge 113+ | 
|  | 141 | +- Check WebGPU support at chrome://gpu | 
|  | 142 | +- Enable WebGPU in browser flags if needed | 
|  | 143 | + | 
|  | 144 | +### Model Loading | 
|  | 145 | +- Verify stable internet connection | 
|  | 146 | +- Check browser console for errors | 
|  | 147 | +- Clear browser cache if needed | 
|  | 148 | + | 
|  | 149 | +### Performance | 
|  | 150 | +- Close GPU-intensive applications | 
|  | 151 | +- Use smaller models for better performance | 
|  | 152 | +- Ensure sufficient RAM (4GB+) | 
|  | 153 | + | 
|  | 154 | +## License | 
|  | 155 | + | 
|  | 156 | +Open source project. See license file for details. | 
0 commit comments