215 lines
3.8 KiB
Markdown
215 lines
3.8 KiB
Markdown
|
|
# 🚀 Commandes rapides - START ICI
|
||
|
|
|
||
|
|
## ⚡ Démarrage rapide (3 commandes)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Aller dans le dossier
|
||
|
|
cd /mnt/e/My\ IA
|
||
|
|
|
||
|
|
# 2. Tuer l'ancien processus sur le port 9001 (si existant)
|
||
|
|
fuser -k 9001/tcp 2>/dev/null
|
||
|
|
|
||
|
|
# 3. Tout lancer
|
||
|
|
bash start.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
**Ouvrir dans le navigateur** : http://localhost:9000
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🔥 Si le script ne marche pas : Lancement manuel
|
||
|
|
|
||
|
|
### Terminal 1 : Backend
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd /mnt/e/My\ IA/backend
|
||
|
|
|
||
|
|
# Créer venv si pas fait
|
||
|
|
python3 -m venv venv
|
||
|
|
|
||
|
|
# Activer
|
||
|
|
. venv/bin/activate
|
||
|
|
|
||
|
|
# Installer dépendances
|
||
|
|
pip install -r requirements.txt
|
||
|
|
|
||
|
|
# LANCER
|
||
|
|
python main.py
|
||
|
|
```
|
||
|
|
|
||
|
|
Tu verras :
|
||
|
|
```
|
||
|
|
INFO: Uvicorn running on http://0.0.0.0:9001
|
||
|
|
```
|
||
|
|
|
||
|
|
### Terminal 2 : Frontend
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd /mnt/e/My\ IA/frontend
|
||
|
|
|
||
|
|
# LANCER
|
||
|
|
python3 -m http.server 9000
|
||
|
|
```
|
||
|
|
|
||
|
|
### Navigateur
|
||
|
|
|
||
|
|
Ouvrir : **http://localhost:9000**
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🛑 Arrêter tout
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Méthode 1 : Script
|
||
|
|
bash stop.sh
|
||
|
|
|
||
|
|
# Méthode 2 : Tuer les processus
|
||
|
|
pkill -f "python main.py"
|
||
|
|
pkill -f "http.server 9000"
|
||
|
|
pkill ollama
|
||
|
|
|
||
|
|
# Méthode 3 : Par port
|
||
|
|
fuser -k 9001/tcp # Backend
|
||
|
|
fuser -k 9000/tcp # Frontend
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🔍 Vérifier que tout tourne
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Backend (doit retourner du JSON)
|
||
|
|
curl http://localhost:9001/health
|
||
|
|
|
||
|
|
# Frontend (doit retourner du HTML)
|
||
|
|
curl http://localhost:9000 | head -5
|
||
|
|
|
||
|
|
# Ollama
|
||
|
|
curl http://localhost:11434/api/tags
|
||
|
|
|
||
|
|
# Tout en un
|
||
|
|
cat > check.sh << 'EOF'
|
||
|
|
#!/bin/bash
|
||
|
|
echo "Backend (9001):"
|
||
|
|
curl -s http://localhost:9001/health | python3 -m json.tool 2>/dev/null || echo "❌ Non accessible"
|
||
|
|
echo -e "\nFrontend (9000):"
|
||
|
|
curl -s http://localhost:9000 | grep -q "<!DOCTYPE" && echo "✅ OK" || echo "❌ Non accessible"
|
||
|
|
echo -e "\nOllama (11434):"
|
||
|
|
curl -s http://localhost:11434/api/tags | python3 -m json.tool 2>/dev/null | head -3 || echo "❌ Non accessible"
|
||
|
|
EOF
|
||
|
|
chmod +x check.sh
|
||
|
|
bash check.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 💡 Ports utilisés
|
||
|
|
|
||
|
|
| Service | Port | URL |
|
||
|
|
|----------|------|-------------------------------|
|
||
|
|
| Backend | 9001 | http://localhost:9001 |
|
||
|
|
| Frontend | 9000 | http://localhost:9000 |
|
||
|
|
| Ollama | 11434| http://localhost:11434 |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🐛 Résolution de problèmes
|
||
|
|
|
||
|
|
### Erreur : Address already in use
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Trouver ce qui utilise le port
|
||
|
|
lsof -i :9001
|
||
|
|
|
||
|
|
# Tuer le processus
|
||
|
|
fuser -k 9001/tcp
|
||
|
|
|
||
|
|
# Ou tuer par PID
|
||
|
|
kill <PID>
|
||
|
|
```
|
||
|
|
|
||
|
|
### Backend ne démarre pas
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Voir les erreurs
|
||
|
|
cd backend
|
||
|
|
. venv/bin/activate
|
||
|
|
python main.py
|
||
|
|
|
||
|
|
# Réinstaller les dépendances
|
||
|
|
pip install --upgrade -r requirements.txt
|
||
|
|
```
|
||
|
|
|
||
|
|
### Frontend affiche page blanche
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Vérifier que index.html existe
|
||
|
|
ls -la frontend/index.html
|
||
|
|
|
||
|
|
# Si non, retélécharger l'archive
|
||
|
|
```
|
||
|
|
|
||
|
|
### WebSocket ne connecte pas
|
||
|
|
|
||
|
|
Le backend doit tourner **avant** d'ouvrir le frontend.
|
||
|
|
|
||
|
|
1. Lancer le backend
|
||
|
|
2. Attendre le message "Uvicorn running"
|
||
|
|
3. Puis ouvrir http://localhost:9000
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## ✅ Checklist avant de commencer
|
||
|
|
|
||
|
|
- [ ] WSL2 installé
|
||
|
|
- [ ] Python 3.10+ : `python3 --version`
|
||
|
|
- [ ] Ollama installé : `which ollama`
|
||
|
|
- [ ] Modèle téléchargé : `ollama list`
|
||
|
|
- [ ] Fichiers présents : `ls -la frontend/index.html`
|
||
|
|
- [ ] Ports libres : `lsof -i :9000` et `lsof -i :9001` → rien
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📱 Ouvrir dans le navigateur (Windows)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Depuis WSL
|
||
|
|
cmd.exe /c start http://localhost:9000
|
||
|
|
|
||
|
|
# Ou taper directement dans Windows :
|
||
|
|
# http://localhost:9000
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🎯 Si TOUT échoue : Réinstallation propre
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Tout arrêter
|
||
|
|
bash stop.sh
|
||
|
|
pkill -9 python
|
||
|
|
pkill -9 ollama
|
||
|
|
|
||
|
|
# 2. Nettoyer
|
||
|
|
rm -rf backend/venv
|
||
|
|
rm /tmp/*.log
|
||
|
|
rm /tmp/ai-assistant-*.pid
|
||
|
|
|
||
|
|
# 3. Retélécharger l'archive
|
||
|
|
# Télécharger ai-code-assistant.zip
|
||
|
|
|
||
|
|
# 4. Extraire proprement
|
||
|
|
unzip -o ai-code-assistant.zip
|
||
|
|
cd ai-code-assistant
|
||
|
|
|
||
|
|
# 5. Lancer
|
||
|
|
chmod +x *.sh
|
||
|
|
bash start.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**EN CAS DE DOUTE : Lance les commandes du Lancement manuel (Terminal 1 + Terminal 2)**
|
||
|
|
|
||
|
|
C'est la méthode la plus fiable pour voir exactement ce qui se passe ! 🎉
|