feat: define canonical AI extraction schema with vision-first prompt and add vision priority verification script

This commit is contained in:
Michael committed 2025-12-22 10:38:08 +01:00
1 parent 83fa8ed734
commit 2fae5350b3
4 files changed
+128 -75

No files matched your search

+12 -36
View File
@@ -1,40 +1,16 @@
# Task: Fix Screenshot Update Issue
# Task Board: Vision-Based Price Extraction
## Context
## 🚀 Current Focus
The user reports that in the "Suivi prix" (Tracking) section, triggering an update ("Mise à jour") does not update the screenshot. This has been identified as a caching issue due to static filenames.
- [x] Analysing current hybrid (Text + Image) extraction logic
- [x] Proposing "Vision First" strategy to owner
- [ ] **Implementation Phase**:
- [ ] Update `ai_schema.py` STRICT Vision Definition.
- [ ] Refine Prompt with "IMAGE IS TRUTH" directive.
- [ ] **Verification Phase**:
- [ ] Verify prompt generation.
## Current Focus
## 📝 Progress Log
Implementing logic to generate unique timestamped filenames for screenshots to bypass browser caching and ensure the latest image is displayed.
## Master Plan
- [x] Modify `tracking_scraper_service.py` to use timestamped filenames for tracking screenshots <!-- id: 0 -->
- [x] Verify that `item_service.py` correctly picks up the new files <!-- id: 1 -->
- [x] Create verification script `verify_screenshot_update.py` <!-- id: 2 -->
- [x] Run verification and confirm fix <!-- id: 3 -->
- [x] Modify `ItemService.get_items` to scan filesystem for latest screenshot <!-- id: 4 -->
- [x] Update `ItemService.delete_item` to clean up all related screenshots <!-- id: 6 -->
- [x] Create `verify_fix_item_service.py` to test the new logic <!-- id: 5 -->
## Current Focus
Improving price extraction reliability for B&M Stores and others.
- [x] Analyze `ai_schema.py` to check the extraction prompt <!-- id: 7 -->
- [x] Improve `ScraperService._extract_text` to be more targeted (e.g. main content only) <!-- id: 8 -->
- [x] Update AI prompt to better handle multiple prices (unit vs package) <!-- id: 9 -->
- [x] Verify extraction logic with simulation script <!-- id: 10 -->
## Progress Log
- Identified the issue: `ScraperService` overwrites `item_{id}.png`.
- Created implementation plan.
- User approved plan.
- Implemented filesystem scanning in `ItemService`.
- Verified fix with `verify_fix_item_service.py` successfully.
- Improved AI prompt to ignore unit prices (like "Prix au litre").
- Enhanced text extraction to remove menu/footer noise.
- Verified logic with `verify_extraction_logic.py` (simulated).
- **Fixed HT vs TTC issue**: AI was extracting 1.15€ (HT) instead of 1.38€ (TTC). Updated prompt to prioritize "Taxe incluse"/TTC prices.
- **2025-12-22**: Initialized task. Confirmed current system is *already* sending images, but likely confusing the AI with conflicting text data.
- **2025-12-22**: User selected **Option 2 (Vision Priority)**. Proceeding to rewrite AI System Prompt.