branch backend + ajout du serveur backend, next, et sqlite

This commit is contained in:
streaper2
2026-04-29 15:45:09 +02:00
parent 105eb1cab0
commit cea2fab989
42 changed files with 10566 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ import '../../services/score_calculator_service.dart';
import '../../services/grouping_analyzer_service.dart';
import '../../services/distortion_correction_service.dart';
import '../../services/opencv_target_service.dart';
import '../../services/ai_export_service.dart';
enum AnalysisState { initial, loading, success, error }
@@ -688,6 +689,42 @@ class AnalysisProvider extends ChangeNotifier {
_groupingResult = _groupingAnalyzerService.analyzeGrouping(_shots);
}
/// Exporte l'image et le json vers le backend IA
Future<bool> exportToAiBackend() async {
if (_imagePath == null || _targetType == null) {
_errorMessage = "Impossible d'exporter : image ou type de cible manquant.";
notifyListeners();
return false;
}
// Identifiant de session temporaire si non sauvegardée
final sessionId = _shots.isNotEmpty && _shots.first.sessionId.isNotEmpty
? _shots.first.sessionId
: 'session_${DateTime.now().millisecondsSinceEpoch}';
final service = AiExportService(); // Local instanciation for simplicity
_state = AnalysisState.loading;
notifyListeners();
final success = await service.exportData(
imagePath: _imagePath!,
sessionId: sessionId,
targetType: _targetType!,
targetCenterX: _targetCenterX,
targetCenterY: _targetCenterY,
targetRadius: _targetRadius,
shots: _shots,
);
_state = AnalysisState.success;
if (!success) {
_errorMessage = "Échec de l'export vers le serveur IA.";
}
notifyListeners();
return success;
}
/// Save the session
Future<Session> saveSession({String? notes}) async {
if (_imagePath == null || _targetType == null) {