- 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>
82 lines
2.9 KiB
Python
82 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Script de Correction des Imports React Flow
|
|
Auteur : Dom, Alice, Kiro - 8 janvier 2026
|
|
|
|
Corrige tous les imports React Flow pour utiliser @xyflow/react
|
|
"""
|
|
|
|
import os
|
|
import re
|
|
from pathlib import Path
|
|
|
|
def fix_react_flow_imports():
|
|
"""
|
|
Corrige tous les imports React Flow dans le frontend
|
|
"""
|
|
frontend_path = Path("visual_workflow_builder/frontend/src")
|
|
|
|
# Patterns de remplacement
|
|
replacements = [
|
|
# Imports de modules
|
|
(r"from 'react-flow-renderer'", "from '@xyflow/react'"),
|
|
(r"from \"react-flow-renderer\"", "from \"@xyflow/react\""),
|
|
(r"import.*from 'react-flow-renderer'", lambda m: m.group(0).replace("react-flow-renderer", "@xyflow/react")),
|
|
(r"import.*from \"react-flow-renderer\"", lambda m: m.group(0).replace("react-flow-renderer", "@xyflow/react")),
|
|
|
|
(r"from 'reactflow'", "from '@xyflow/react'"),
|
|
(r"from \"reactflow\"", "from \"@xyflow/react\""),
|
|
(r"import.*from 'reactflow'", lambda m: m.group(0).replace("reactflow", "@xyflow/react")),
|
|
(r"import.*from \"reactflow\"", lambda m: m.group(0).replace("reactflow", "@xyflow/react")),
|
|
|
|
# CSS imports
|
|
(r"'react-flow-renderer/dist/style.css'", "'@xyflow/react/dist/style.css'"),
|
|
(r"\"react-flow-renderer/dist/style.css\"", "\"@xyflow/react/dist/style.css\""),
|
|
(r"'reactflow/dist/style.css'", "'@xyflow/react/dist/style.css'"),
|
|
(r"\"reactflow/dist/style.css\"", "\"@xyflow/react/dist/style.css\""),
|
|
]
|
|
|
|
files_processed = 0
|
|
|
|
# Parcourir tous les fichiers TypeScript/JavaScript
|
|
for file_path in frontend_path.rglob("*.ts"):
|
|
process_file(file_path, replacements)
|
|
files_processed += 1
|
|
|
|
for file_path in frontend_path.rglob("*.tsx"):
|
|
process_file(file_path, replacements)
|
|
files_processed += 1
|
|
|
|
print(f"✅ {files_processed} fichiers traités")
|
|
|
|
def process_file(file_path, replacements):
|
|
"""
|
|
Traite un fichier individuel
|
|
"""
|
|
try:
|
|
with open(file_path, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
original_content = content
|
|
|
|
# Appliquer tous les remplacements
|
|
for pattern, replacement in replacements:
|
|
if callable(replacement):
|
|
content = re.sub(pattern, replacement, content)
|
|
else:
|
|
content = re.sub(pattern, replacement, content)
|
|
|
|
# Sauvegarder si modifié
|
|
if content != original_content:
|
|
with open(file_path, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
print(f"📝 Corrigé: {file_path}")
|
|
|
|
except Exception as e:
|
|
print(f"❌ Erreur avec {file_path}: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
print("🔧 Correction des imports React Flow...")
|
|
fix_react_flow_imports()
|
|
print("✅ Correction terminée") |