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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# LLMUI Core v0.5.0

[![AGPL v3](https://img.shields.io/badge/AGPL%20v3-Open%20Source-green.svg)](https://www.gnu.org/licenses/agpl-3.0)
[![Commons Clause](https://img.shields.io/badge/Commons%20Clause-No%20Commercial-red.svg)](LICENSE)
[![Enterprise Clause](https://img.shields.io/badge/Enterprise-Publication%20Required-orange.svg)](ENTERPRISE_CLAUSE_EXPLAINED.md)
[![Python](https://img.shields.io/badge/Python-3.8%2B-blue.svg)](https://python.org)
[![Platform](https://img.shields.io/badge/Platform-Linux%20%7C%20WSL-lightgrey.svg)](https://kernel.org)

> **Multi-model AI consensus platform with digital sovereignty**

Developed by **Francois Chalut** - A Quebec solution for local and ethical artificial intelligence.

---

## ๐ŸŽฏ Overview

LLMUI Core is an innovative consensus platform between multiple language models (LLMs), allowing you to:

- **Orchestrate multiple AI models** in parallel (workers + mergers)
- **Obtain consensus responses** for superior quality
- **Ensure digital sovereignty** - local hosting, no cloud
- **Integrate advanced memory systems** (RAG, hybrid)
- **Process files** (PDF, DOCX, images, etc.)
- **Maintain complete history** with SQLite

### Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Nginx     โ”‚ โ† Web interface (port 80/443)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ llmui-proxy โ”‚ โ† Session management, auth (port 8080)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚llmui-backendโ”‚ โ† LLM orchestration (port 5000)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Ollama    โ”‚ โ† Local models (port 11434)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  โ€ข phi3:3.8b (worker)
  โ€ข gemma2:2b (worker)
  โ€ข granite4:micro-h (merger)
```

---

## ๐Ÿ“‹ Prerequisites

### Recommended Hardware
- **CPU**: 4 cores minimum, 8+ recommended
- **RAM**: 8GB minimum, 16GB+ recommended
- **Disk**: 20GB minimum, 50GB+ recommended
- **GPU**: Optional but greatly improves performance

### Operating System

#### Native Linux
- Debian 11/12
- Ubuntu 20.04/22.04/24.04
- Rocky Linux 8/9
- RHEL 8/9

#### Windows via WSL
- Windows 10/11 with WSL2 enabled
- Ubuntu 20.04/22.04/24.04 distribution in WSL
- 16GB RAM recommended for Windows + WSL

### Software
- Python 3.8+
- Root access (sudo)
- Git

---

## ๐ŸชŸ Installation on Windows (WSL)

### Step 1: Enable WSL2

Open PowerShell as administrator:

```powershell
# Enable WSL
wsl --install

# Or if already installed, upgrade to WSL2
wsl --set-default-version 2

# Install Ubuntu
wsl --install -d Ubuntu-22.04
```

Restart your computer after installation.

### Step 2: WSL Configuration

Launch Ubuntu from the Start menu and configure your user.

```bash
# Update the system
sudo apt update && sudo apt upgrade -y

# Install prerequisites
sudo apt install -y git python3 python3-pip
```

### Step 3: Install LLMUI Core in WSL

```bash
# Clone the repository
git clone https://github.com/GenAICos/llmui-core.git
cd llmui-core

# Launch installation with Andy
sudo bash andy_setup.sh
```

### Access from Windows

Once installed in WSL, access the interface via:

```
http://localhost/
```

Windows browser can directly access WSL services!

### Important Notes for WSL

- **Performance**: WSL2 offers excellent performance but will consume Windows RAM
- **Files**: Access WSL files from Windows via `\\wsl$\Ubuntu-22.04\`
- **Network**: WSL ports are automatically forwarded to Windows
- **Memory**: Configure `.wslconfig` to limit RAM usage if needed

#### .wslconfig Configuration (optional)

Create `C:\Users\YourName\.wslconfig`:

```ini
[wsl2]
memory=8GB
processors=4
swap=4GB
```

---

## ๐Ÿš€ Quick Installation with Andy

**Andy** is the autonomous DevOps assistant that automates the complete installation of LLMUI Core.

### One-Command Installation

```bash
# Clone repository
git clone https://github.com/GenAICos/llmui-core.git
cd llmui-core

# Launch interactive installation
sudo bash andy_setup.sh
```

### Complete Automatic Installation

```bash
# Installation in 3 automated steps
sudo python3 andy_installer.py      # Step 1: System base
sudo python3 andy_deploy_source.py  # Step 2: Source files
sudo python3 andy_start_services.py # Step 3: Services
```

Andy will automatically:
- โœ… Update OS
- โœ… Install Ollama + 3 LLM models
- โœ… Configure Python + dependencies
- โœ… Create systemd services
- โœ… Configure Nginx + SSL
- โœ… Configure firewall
- โœ… Verify installation

> **Note**: Andy will only ask you for the username and password for the LLMUI interface.

### What Andy Does

1. **Base Installation** (`andy_installer.py`)
   - Automatic system detection (apt/dnf/yum)
   - System dependency installation
   - Ollama installation and model download
   - Python virtual environment creation
   - Systemd service configuration
   - Nginx and firewall configuration

2. **Source Deployment** (`andy_deploy_source.py`)
   - Git repository clone (or manual copy)
   - File installation in `/opt/llmui-core/`
   - Permission configuration

3. **Service Startup** (`andy_start_services.py`)
   - Systemd service activation
   - Backend โ†’ proxy โ†’ nginx startup
   - Service status verification
   - HTTP test and access URL display

### Interactive Menu (andy_setup.sh)

```
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                           MAIN MENU                                       โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  [1] Complete installation (recommended)
  [2] Base installation only
  [3] Deploy source files
  [4] Start services
  [5] Verify installation
  [6] View logs
  [7] Read documentation
  [Q] Quit
```

---

## ๐Ÿ“ฆ Project Structure

```
llmui-core/
โ”œโ”€โ”€ andy_setup.sh              # Interactive menu
โ”œโ”€โ”€ andy_installer.py          # System base installation
โ”œโ”€โ”€ andy_deploy_source.py      # Source deployment
โ”œโ”€โ”€ andy_start_services.py     # Service startup
โ”œโ”€โ”€ README.md                  # This file
โ”œโ”€โ”€ README_ANDY.md             # Andy documentation
โ”œโ”€โ”€ INSTALL.md                 # Detailed installation guide
โ”œโ”€โ”€ LICENSE                    # Proprietary license
โ”‚
โ”œโ”€โ”€ src/                       # Backend source code
โ”‚   โ”œโ”€โ”€ llmui_backend.py      # Main FastAPI server
โ”‚   โ”œโ”€โ”€ llmui_proxy.py        # Proxy server
โ”‚   โ”œโ”€โ”€ auth.py               # Authentication
โ”‚   โ”œโ”€โ”€ database.py           # SQLite management
โ”‚   โ”œโ”€โ”€ memory.py             # Memory system
โ”‚   โ””โ”€โ”€ file_processor.py     # File processing
โ”‚
โ”œโ”€โ”€ web/                       # Web interface
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ””โ”€โ”€ assets/
โ”‚
โ”œโ”€โ”€ config.yaml                # Main configuration
โ”œโ”€โ”€ requirements.txt           # Python dependencies
โ”‚
โ””โ”€โ”€ docs/                      # Documentation
    โ”œโ”€โ”€ ARCHITECTURE.md
    โ”œโ”€โ”€ API.md
    โ”œโ”€โ”€ CONFIGURATION.md
    โ””โ”€โ”€ TROUBLESHOOTING.md
```

---

## ๐Ÿ”ง Configuration

### Main File: `config.yaml`

```yaml
server:
  host: "0.0.0.0"
  port: 5000
  ssl_enabled: false

ollama:
  base_url: "http://localhost:11434"
  models:
    workers:
      - "phi3:3.8b"
      - "gemma2:2b"
    merger: "granite4:micro-h"

database:
  path: "/opt/llmui-core/data/llmui.db"

security:
  jwt_secret: "auto-generated"
  session_timeout: 3600
```

### Ports Used

| Service | Port | Description |
|---------|------|-------------|
| Nginx | 80/443 | Web interface |
| llmui-proxy | 8080 | Proxy + auth |
| llmui-backend | 5000 | Backend API |
| Ollama | 11434 | LLM server |

---

## ๐ŸŽฎ Usage

### Interface Access

Once installed, access LLMUI Core via your browser:

**Linux:**
```
http://YOUR_IP/
```

**Windows (WSL):**
```
http://localhost/
```

The server IP is displayed at the end of Andy's installation.

### Service Management

```bash
# Service status
sudo systemctl status llmui-backend
sudo systemctl status llmui-proxy
sudo systemctl status nginx

# Restart services
sudo systemctl restart llmui-backend
sudo systemctl restart llmui-proxy
sudo systemctl restart nginx

# Real-time logs
sudo journalctl -u llmui-backend -f
sudo journalctl -u llmui-proxy -f
```

### REST API

Complete API documentation available in [`docs/API.md`](docs/API.md).

Endpoint examples:

```bash
# Health check
curl http://localhost:5000/api/health

# Model list
curl http://localhost:5000/api/models

# New conversation
curl -X POST http://localhost:5000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello!", "user_id": "user123"}'
```

---

## ๐Ÿ“Š Features

### โœจ Multi-Model Consensus

LLMUI core uses a unique approach:
1. **Workers analyze** the prompt in parallel
2. **Merger synthesizes** responses into consensus
3. **Superior quality** thanks to model diversity

### ๐Ÿง  Advanced Memory System

- **Short-term memory**: Conversation context

### ๐Ÿ“„ File Processing

Supported formats:
- **Documents**: PDF, DOCX, TXT, MD
- **Images**: PNG, JPG, WEBP
- **Data**: CSV, JSON, YAML
- **Code**: Python, JavaScript, etc.

### ๐Ÿ” Security

- **JWT authentication**
- **Session encryption**
- **Configured firewall**
- **Nginx security headers**
- **Service isolation**
- **Strict permissions**

---

## ๐Ÿ“– Complete Documentation

- **[INSTALL.md](INSTALL.md)** - Detailed installation guide
- **[README_ANDY.md](README_ANDY.md)** - Andy documentation
- **[ARCHITECTURE.md](docs/ARCHITECTURE.md)** - Technical architecture
- **[API.md](docs/API.md)** - REST API documentation
- **[CONFIGURATION.md](docs/CONFIGURATION.md)** - Advanced configuration
- **[TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)** - Troubleshooting

---

## ๐Ÿ›  Quick Troubleshooting

### Services Won't Start

```bash
# Check logs
sudo journalctl -u llmui-backend -n 50
sudo journalctl -u llmui-proxy -n 50

# Check permissions
ls -la /opt/llmui-core/

# Check Python environment
/opt/llmui-core/venv/bin/python --version
/opt/llmui-core/venv/bin/pip list
```

### Nginx Error 502

Backend not started:
```bash
sudo systemctl status llmui-backend
sudo systemctl start llmui-backend
```

### Ollama Not Responding

```bash
ollama list
ollama ps
sudo systemctl status ollama
sudo systemctl restart ollama
```

### WSL-Specific Issues

```bash
# Restart WSL from PowerShell (Windows)
wsl --shutdown
wsl

# Check WSL version
wsl --list --verbose

# Free up memory
sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
```

### View Andy Logs

```bash
# Installation log
less /tmp/andy_install.log

# SQLite database
sqlite3 /tmp/andy_installation.db
```

---

## ๐Ÿ“„ Update

```bash
# Backup configuration
sudo cp /opt/llmui-core/config.yaml /opt/llmui-core/config.yaml.bak

# Stop services
sudo systemctl stop llmui-backend llmui-proxy

# Update code
cd /path/to/llmui-core
git pull origin main

# Redeploy
sudo python3 andy_deploy_source.py

# Restart
sudo python3 andy_start_services.py
```

---

## ๐Ÿค Contribution

This project is developed by **Francois Chalut**

For any questions or contributions:
- **Email**: francois.chalut@gmail.com
- **Issues**: [GitHub Issues](https://github.com/GenAICos/llmui-core/issues)

---

## ๐Ÿ“œ License

ยฉ 2025 Francois Chalut.

AGPLv3 + common clause

See [LICENSE](LICENSE) for more details.

---

## ๐ŸŒŸ Project Philosophy

LLMUI Core is part of a vision of **Quebec digital sovereignty**:

- ๐Ÿ‡จ๐Ÿ‡ฆ **Local first**: Complete hosting and control
- ๐Ÿ”“ **Open Architecture**: Extensible and adaptable
- ๐Ÿ›ก๏ธ **Security by design**: Data protection
- ๐Ÿค– **Ethical AI**: Transparency and consensus
- ๐ŸŒฑ **Technological autonomy**: Independence from GAFAM

---

## ๐Ÿ“ž Support

**Documentation**: [GitHub Wiki](https://github.com/GenAICos/llmui-core/wiki)  
**Andy Logs**: `/tmp/andy_install.log`  
**Andy Database**: `/tmp/andy_installation.db`  
**Installation**: `/opt/llmui-core/`

---

**Developed with ๐Ÿ’™ in Quebec by Francois Chalut**