Files
my-ia/TROUBLESHOOTING.md
2026-03-31 13:10:44 +02:00

3.8 KiB

🔧 Guide de dépannage rapide

Problème : 404 sur l'interface web

Cause

Le serveur HTTP démarre mais ne trouve pas index.html

Solution

# 1. Arrêter tout
bash stop.sh

# 2. Vérifier la structure des fichiers
cd /mnt/e/My\ IA  # Ou ton chemin
ls -la
ls -la frontend/

# 3. Tu DOIS voir :
# frontend/
#   └── index.html

# 4. Si index.html manque, télécharge à nouveau l'archive

# 5. Lancer correctement
bash start.sh

# 6. Ouvrir
# http://localhost:9000

Problème : Permission denied avec source

Cause

Utilisation de sh au lieu de bash

Solution

# ❌ PAS COMME ÇA :
sh start.sh

# ✅ COMME ÇA :
bash start.sh

# Ou directement :
./start.sh

Problème : Backend ne démarre pas

Diagnostic

# Voir les logs
cat /tmp/fastapi.log

# Vérifier Python
python3 --version  # Doit être 3.10+

# Vérifier le port 8000
lsof -i :8000

Solution

# Si le port est occupé
kill $(lsof -t -i :8000)

# Relancer
cd /mnt/e/My\ IA/backend
. venv/bin/activate
python main.py

Problème : Ollama non accessible

Diagnostic

curl http://localhost:11434/api/tags

Solution

# Démarrer Ollama
ollama serve &

# Attendre 3 secondes
sleep 3

# Vérifier
ollama list

Lancement manuel complet (si scripts ne marchent pas)

# 1. Aller dans le dossier
cd /mnt/e/My\ IA

# 2. Terminal 1 : Ollama
ollama serve

# 3. Terminal 2 : Backend
cd backend
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
python main.py

# 4. Terminal 3 : Frontend
cd frontend
python3 -m http.server 9000

# 5. Ouvrir navigateur
# http://localhost:9000

Vérification complète

# Vérifier tous les services
echo "=== Ollama ==="
curl -s http://localhost:11434/api/tags | head -5

echo -e "\n=== Backend ==="
curl -s http://localhost:9001/health

echo -e "\n=== Frontend ==="
curl -s http://localhost:9000 | head -5

echo -e "\n=== Processus ==="
ps aux | grep -E "ollama|python|http.server" | grep -v grep

Checklist de debug

  • Ollama installé : which ollama
  • Python 3.10+ : python3 --version
  • Structure correcte : ls -la frontend/index.html
  • Scripts exécutables : ls -la *.sh
  • Ports libres : netstat -tlnp | grep -E "9001|9000"
  • Logs accessibles : cat /tmp/fastapi.log

Réinstallation propre

# 1. Tout arrêter
bash stop.sh
pkill ollama
pkill python

# 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
unzip -o ai-code-assistant.zip
cd ai-code-assistant

# 5. Rendre exécutable
chmod +x start.sh stop.sh

# 6. Démarrer
bash start.sh

Astuce : Vérifier que tout fonctionne

# Ce script vérifie tout en une commande
cat > check.sh << 'EOF'
#!/bin/bash
echo "🔍 Vérification système..."
echo ""

echo "1. Ollama:"
if curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then
    echo "   ✅ Actif"
else
    echo "   ❌ Inactif"
fi

echo "2. Backend (port 8000):"
if curl -s http://localhost:9001/health > /dev/null 2>&1; then
    echo "   ✅ Actif"
else
    echo "   ❌ Inactif"
fi

echo "3. Frontend (port 9000):"
if curl -s http://localhost:9000 > /dev/null 2>&1; then
    echo "   ✅ Actif"
else
    echo "   ❌ Inactif"
fi

echo "4. Fichiers:"
if [ -f "frontend/index.html" ]; then
    echo "   ✅ index.html présent"
else
    echo "   ❌ index.html manquant"
fi

echo ""
echo "URL à ouvrir: http://localhost:9000"
EOF

chmod +x check.sh
bash check.sh

Contact / Support

Si rien ne fonctionne :

  1. Copie la sortie de :
bash check.sh
cat /tmp/fastapi.log
cat /tmp/frontend.log
  1. Vérifie ta structure de fichiers :
tree -L 2
# ou
find . -type f
  1. Partage ces informations pour obtenir de l'aide