Files
Geniusia_v2/test_orchestrator_simple.py
2026-03-05 00:20:25 +01:00

132 lines
4.6 KiB
Python

#!/usr/bin/env python3
"""
Test simple de l'intégration de l'EnhancedWorkflowMatcher dans l'Orchestrator.
Vérifie que les imports et la structure sont corrects.
"""
print('Test simple de l\'intégration EnhancedWorkflowMatcher')
print('='*70)
# Test 1: Vérifier que les imports fonctionnent
print('\n1. Test des imports...')
try:
from geniusia2.core.enhanced_workflow_matcher import EnhancedWorkflowMatcher
print(' ✓ EnhancedWorkflowMatcher importé')
except Exception as e:
print(f' ✗ Erreur import EnhancedWorkflowMatcher: {e}')
exit(1)
try:
from geniusia2.core.multimodal_embedding_manager import MultiModalEmbeddingManager
print(' ✓ MultiModalEmbeddingManager importé')
except Exception as e:
print(f' ✗ Erreur import MultiModalEmbeddingManager: {e}')
exit(1)
# Test 2: Vérifier que l'Orchestrator importe les nouveaux composants
print('\n2. Vérification des imports dans orchestrator.py...')
try:
with open('geniusia2/core/orchestrator.py', 'r') as f:
content = f.read()
if 'from .enhanced_workflow_matcher import EnhancedWorkflowMatcher' in content:
print(' ✓ Import EnhancedWorkflowMatcher trouvé')
else:
print(' ✗ Import EnhancedWorkflowMatcher manquant')
exit(1)
if 'from .multimodal_embedding_manager import MultiModalEmbeddingManager' in content:
print(' ✓ Import MultiModalEmbeddingManager trouvé')
else:
print(' ✗ Import MultiModalEmbeddingManager manquant')
exit(1)
if 'self.multimodal_manager = MultiModalEmbeddingManager' in content:
print(' ✓ Initialisation multimodal_manager trouvée')
else:
print(' ✗ Initialisation multimodal_manager manquante')
exit(1)
if 'self.enhanced_matcher = EnhancedWorkflowMatcher' in content:
print(' ✓ Initialisation enhanced_matcher trouvée')
else:
print(' ✗ Initialisation enhanced_matcher manquante')
exit(1)
if 'def find_matching_workflows_enhanced' in content:
print(' ✓ Méthode find_matching_workflows_enhanced trouvée')
else:
print(' ✗ Méthode find_matching_workflows_enhanced manquante')
exit(1)
except Exception as e:
print(f' ✗ Erreur lors de la vérification: {e}')
exit(1)
# Test 3: Vérifier la structure de la méthode
print('\n3. Vérification de la structure de find_matching_workflows_enhanced...')
try:
# Extraire la méthode
start = content.find('def find_matching_workflows_enhanced')
if start == -1:
print(' ✗ Méthode non trouvée')
exit(1)
# Vérifier les éléments clés
method_content = content[start:start+5000]
checks = [
('screen_state', 'Paramètre screen_state'),
('screenshot', 'Paramètre screenshot'),
('top_k', 'Paramètre top_k'),
('self.enhanced_matcher.find_matching_workflows', 'Appel au matcher'),
('WorkflowMatch', 'Retour de WorkflowMatch'),
('get_feedback_summary', 'Utilisation du feedback')
]
for check_str, description in checks:
if check_str in method_content:
print(f'{description} présent')
else:
print(f'{description} non trouvé (peut être normal)')
except Exception as e:
print(f' ✗ Erreur: {e}')
exit(1)
# Test 4: Vérifier la configuration
print('\n4. Vérification de la configuration du matcher...')
try:
config_checks = [
('screen_weight', 'Poids écran'),
('elements_weight', 'Poids éléments'),
('min_similarity_threshold', 'Seuil de similarité'),
('min_confidence_threshold', 'Seuil de confiance')
]
for check_str, description in config_checks:
if check_str in content:
print(f'{description} configuré')
else:
print(f'{description} non configuré')
except Exception as e:
print(f' ✗ Erreur: {e}')
exit(1)
print('\n' + '='*70)
print('✅ Tous les tests d\'intégration structurelle réussis!')
print('='*70)
print('\n📊 Résumé:')
print(' ✓ EnhancedWorkflowMatcher importé dans Orchestrator')
print(' ✓ MultiModalEmbeddingManager importé dans Orchestrator')
print(' ✓ Instances créées dans __init__')
print(' ✓ Méthode find_matching_workflows_enhanced ajoutée')
print(' ✓ Configuration du matcher présente')
print('\n🎯 Prochaines étapes:')
print(' 1. Tester avec un Orchestrator réel (nécessite torch)')
print(' 2. Tester le matching avec des workflows réels')
print(' 3. Valider le feedback détaillé en production')