Skip to content

Resolve EDL-462 Anomaly detection

yassine sabir a demandé de fusionner feature/EDL-462 vers develop

Branch feature/EDL-462 – Workflow Description

1. Intelligence & AI Configuration

1.1 AI Model Configuration (Modèle de Détection) **Location: **Intelligence et Personnalisation → Configuration IA → Modèle de Détection

  • Role: Configure which AI model(s) are used for inspections.
  • Models: YOLO11m – Damage detection (scratches, dents, cracks, etc.) via backend /api/ai/predict OpenAI GPT-4o Vision – Vehicle part validation (“does this image show Face avant générale?”) Anthropic – Alternative to OpenAI for vehicle part validation
  • Behavior: User enables one model as active. Configuration is stored in localStorage (ai-model-configuration).
  • Billing: OpenAI usage is tracked; billing info is refreshed via /api/openai/billing.

1.2 Confidence Thresholds (Seuils de Confiance) **Location: **Intelligence et Personnalisation → Seuils de Confiance

  • Role: Global thresholds for AI results. Settings: Alert threshold – For YOLO damage detection (default 80%) Validation threshold – For vehicle part validation (default 90%) Notifications – Enable/disable alerts when thresholds are not met
  • Storage: Saved via aiModelService.updateThresholds() in localStorage.

2. Inspection Creation (Nouvelle Inspection)

2.1 Inspection Creation Flow User selects a form model (Simple or Comparaison au retour). Form is rendered with company, driver, default image, and custom sections. User fills fields and uploads images for vehicle parts.

2.2 Image Upload for Vehicle Part Fields (DefaultImageSection)

  • Fields: Face avant générale, Latéral gauche avant, Latéral gauche arrière, Face arrière générale, Coffre ouvert, Latéral droit arrière, Latéral droit avant, Sièges avant, Sièges arrière, Tableau de bord.
  • Flow: Image guidance ImageGuidanceDialog opens with instructions (distance, angle, tips) per vehicle part. User continues → file picker opens. Pre-AI checks (client-side) validateImageDistance() – Heuristic check (too far / too close / optimal) from image size. assessImageQuality() – Quality check. Warnings may appear, but flow continues. Vehicle part validation (AI – OpenAI/Anthropic only) validateVehiclePartImage() in aiImageValidation.ts Uses OpenAI or Anthropic (no YOLO support here).
  • Prompt: “Does this image show [expected part]?”. Uses validationThreshold from aiModelService. If OpenAI/Anthropic disabled or unavailable → fallback validation (basic checks, 50% confidence). Result shown in ImageValidationDialog (valid/invalid, confidence, suggestions). User accepts validation handleValidationAccept → handleFieldChange(fieldId, file) → passes file to formFiller. Damage detection (YOLO) formFiller.handleFieldChange → handleAiForDefaultImage() when the field is in DefaultImageSection. Calls predictCarDamageYOLO11m(file) → POST /api/ai/predict. Returns: has_damage, bounding boxes, damage types (dent, scratch, crack, etc.), confidence. If confidence < alertThreshold → threshold alert (no damage recorded). If confidence ≥ threshold → AI result dialog (bounding boxes, damage types). AI result dialog User can Accept or Cancel. Accept → image saved in the field and, if has_damage, copied to “Photos des anomalies” with AI result. Cancel → image discarded.

2.3 Photos des anomalies Special field for images with detected damage. Images with damage are automatically added here. User can open an image to see YOLO result (bounding boxes, damage types, labels).

2.4 Submit Inspection User submits → data sent to backend → inspection created.

Modification effectuée par yassine sabir

Rapports de requête de fusion