- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
103 lines
3.1 KiB
Bash
Executable File
103 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Fix pour l'apprentissage complet - HuggingFace cache + GraphBuilder
|
|
|
|
set -e
|
|
|
|
echo "🔧 Correction du Pipeline d'Apprentissage"
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "❌ Ce script doit être exécuté avec sudo"
|
|
echo "Usage: sudo bash fix_learning_pipeline.sh"
|
|
exit 1
|
|
fi
|
|
|
|
# ==============================================================================
|
|
# 1. FIX HUGGINGFACE CACHE
|
|
# ==============================================================================
|
|
echo "📦 Fix 1/2: Cache HuggingFace"
|
|
echo "-----------------------------"
|
|
|
|
# Créer le répertoire cache HuggingFace
|
|
echo "📁 Création du répertoire cache..."
|
|
mkdir -p /home/rpa/.cache/huggingface
|
|
mkdir -p /home/rpa/.cache/huggingface/hub
|
|
mkdir -p /home/rpa/.cache/torch
|
|
|
|
# Définir les permissions correctes
|
|
echo "🔐 Configuration des permissions..."
|
|
chown -R rpa:rpa /home/rpa/.cache
|
|
chmod -R 755 /home/rpa/.cache
|
|
|
|
echo "✅ Cache HuggingFace configuré"
|
|
echo ""
|
|
|
|
# ==============================================================================
|
|
# 2. FIX GRAPHBUILDER
|
|
# ==============================================================================
|
|
echo "📦 Fix 2/2: GraphBuilder Method"
|
|
echo "--------------------------------"
|
|
|
|
FILE="/opt/rpa_vision_v3/server/processing_pipeline.py"
|
|
|
|
# Créer une sauvegarde
|
|
BACKUP="${FILE}.backup_graphbuilder_$(date +%Y%m%d_%H%M%S)"
|
|
echo "💾 Création sauvegarde: $BACKUP"
|
|
cp "$FILE" "$BACKUP"
|
|
|
|
# Corriger la ligne 405 : build_from_states → build_from_session
|
|
echo "🔧 Correction de la méthode..."
|
|
sed -i '405s/self.graph_builder.build_from_states(screen_states)/self.graph_builder.build_from_session(session)/' "$FILE"
|
|
|
|
# Vérifier la modification
|
|
if grep -q "build_from_session(session)" "$FILE"; then
|
|
echo "✅ Méthode GraphBuilder corrigée"
|
|
else
|
|
echo "❌ Erreur lors de la modification"
|
|
echo "Restauration de la sauvegarde..."
|
|
cp "$BACKUP" "$FILE"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "📋 Contexte modifié:"
|
|
echo "-------------------"
|
|
grep -A 2 -B 2 "build_from_session" "$FILE" | grep -v "^--$"
|
|
echo ""
|
|
|
|
# ==============================================================================
|
|
# 3. REDÉMARRAGE DU WORKER
|
|
# ==============================================================================
|
|
echo "🔄 Redémarrage du worker..."
|
|
systemctl restart rpa-vision-v3-worker.service
|
|
sleep 3
|
|
|
|
# Vérifier le statut
|
|
STATUS=$(systemctl is-active rpa-vision-v3-worker.service)
|
|
if [ "$STATUS" = "active" ]; then
|
|
echo "✅ Worker redémarré avec succès"
|
|
else
|
|
echo "❌ Worker en état: $STATUS"
|
|
echo "Voir les logs: sudo journalctl -u rpa-vision-v3-worker -n 50"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "✅ CORRECTIONS TERMINÉES"
|
|
echo ""
|
|
echo "📝 Résumé:"
|
|
echo " 1. ✅ Cache HuggingFace créé pour utilisateur rpa"
|
|
echo " 2. ✅ GraphBuilder.build_from_session() utilisé"
|
|
echo " 3. ✅ Worker redémarré"
|
|
echo ""
|
|
echo "🎯 Prochaine étape:"
|
|
echo " Capturer une nouvelle session pour tester l'apprentissage complet"
|
|
echo ""
|
|
echo "💾 Sauvegardes:"
|
|
echo " - $BACKUP"
|
|
echo ""
|
|
echo "🔄 Pour restaurer:"
|
|
echo " sudo cp $BACKUP $FILE"
|
|
echo " sudo systemctl restart rpa-vision-v3-worker.service"
|