Compare commits

...

2 Commits

Author SHA1 Message Date
1c13ebd76f docs: update VERSION and SESSION_STATE for v1.14.3 - Image Confirmation UX
Documented the complete image pipeline feature:
- v1.14.1: Type system fix (photo_path fields)
- v1.14.2: Serialization fix (Blob to base64)
- v1.14.3: User control (image confirmation buttons)

Users now have full control over whether extracted photos are auto-saved
through the 'Use Photo' / 'Skip Photo' buttons in the editing form.
2026-04-21 20:01:28 +03:00
c3f63ade6a feat: add image confirmation step to AI extraction flow
Users now see the extracted photo during item editing and can choose to:
- 'Use Photo': Auto-save the image with the item
- 'Skip Photo': Create item without saving the photo

Changes:
1. frontend/components/AIOnboarding.tsx: Added image preview panel in edit form
   - Shows extracted image to user
   - Buttons to accept/reject photo
   - Visual feedback when photo is skipped

2. frontend/hooks/useAIExtraction.ts: Updated confirmSingleItem and confirmAllItems
   - Respect user's photo decision (_skipPhoto flag)
   - Only pass extractedImageBlob if user approved it
   - Prevents unwanted auto-photo-save

This gives users full control over which extracted photos are auto-saved.
2026-04-21 20:00:55 +03:00
7 changed files with 80 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
{
"version": "1.14.2",
"version": "1.14.3",
"lastUpdated": "2026-04-21",
"phase": "Phase 3 Complete - Blob Serialization Fix"
"phase": "Phase 3 Complete - Image Confirmation UX"
}

View File

@@ -1,9 +1,9 @@
# CURRENT AI WORKING SESSION — HANDOVER
**Active AI:** Claude Haiku 4.5
**Last Updated:** 2026-04-21 (Session 29 - Image Serialization Bugfix)
**Current Version:** v1.14.2 (Blob serialization + photo display fixes complete)
**Branch:** dev (Phase 3 complete + critical fixes applied, production-ready)
**Last Updated:** 2026-04-21 (Session 29 - Image Pipeline Complete)
**Current Version:** v1.14.3 (Full image pipeline: extraction, serialization, confirmation, save, display)
**Branch:** dev (Phase 3 production-ready with user control over photo extraction)
---
@@ -57,6 +57,32 @@ The extracted image Blob object cannot be JSON serialized. When `handleOnboardin
**Status:****FIXED** — Full image pipeline working: extract → serialize → save → display
### Part 3 - User Confirmation (v1.14.3)
**User Feedback:** "Photo should ask user if is ok or not to save that image"
**Solution:** Added image preview and confirmation buttons to the item editing form
**Changes:**
1. **frontend/components/AIOnboarding.tsx**:
- Display extracted image in the edit form (between photo preview and fields)
- Two buttons: "Use Photo" (saves) and "Skip Photo" (creates item without photo)
- Visual feedback showing when photo will be skipped
2. **frontend/hooks/useAIExtraction.ts**:
- Updated `confirmSingleItem`: Check `_skipPhoto` flag before including image blob
- Updated `confirmAllItems`: Respect skip flag for batch operations
- Only pass `extractedImageBlob` if user explicitly approved it
**User Flow (v1.14.3):**
1. User takes photo and extracts item data
2. User sees extracted image and can edit fields
3. **NEW**: User can click "Use Photo" or "Skip Photo" (has control!)
4. Item is created ± photo based on user choice
5. If photo approved: auto-photo-save happens, image displays
6. If photo skipped: item created without image, user can upload later
**Status:****COMPLETE** — Users now control whether extracted photos are auto-saved
---
## SESSION 28 SUMMARY — Phase 3 COMPLETE: AI Extraction + Auto-Photo-Save Feature Implementation

View File

@@ -224,7 +224,40 @@ export default function AIOnboarding({ onCancel, onComplete, categories, invento
Back to List
</button>
</div>
{/* Image Preview Section */}
{image && (
<div className="bg-surface/70 border border-slate-800/50 rounded-2xl overflow-hidden">
<div className="relative h-40 md:h-48 bg-black/20 flex items-center justify-center">
<img
src={image}
alt="Extracted label"
className="max-w-full max-h-full object-contain"
/>
</div>
<div className="p-3 space-y-2">
<p className="text-xs text-muted font-normal">Extracted Photo</p>
<div className="flex gap-2">
<button
onClick={() => updateEditingItem({ _skipPhoto: false })}
className="flex-1 px-3 py-2 bg-green-500/20 border border-green-500/50 text-green-400 rounded-lg hover:bg-green-500/30 transition-colors font-normal text-xs"
>
Use Photo
</button>
<button
onClick={() => updateEditingItem({ _skipPhoto: true })}
className="flex-1 px-3 py-2 bg-rose-500/20 border border-rose-500/50 text-rose-400 rounded-lg hover:bg-rose-500/30 transition-colors font-normal text-xs"
>
Skip Photo
</button>
</div>
{extractedItems[editingIndex]._skipPhoto && (
<p className="text-xs text-rose-400/80">Photo will not be saved</p>
)}
</div>
</div>
)}
<div className="flex-1 overflow-y-auto space-y-2 pr-1 scrollbar-hide">
<div data-testid="extracted-name" className="bg-surface py-2.5 px-4 rounded-[1.2rem] border border-slate-800 focus-within:border-primary/50 transition-colors group">
<label className="text-xs text-muted font-normal mb-0.5 block group-focus-within:text-primary transition-colors tracking-tight">Item Name</label>

View File

@@ -133,6 +133,8 @@ export function useAIExtraction(inventory: Item[], onComplete: (itemData: any) =
const confirmSingleItem = (index: number) => {
const data = extractedItems[index];
const skipPhoto = data._skipPhoto === true; // User explicitly rejected the photo
const newItem = {
name: String(data.Item || data.name || "New AI Item"),
category: String(data.Category || data.category || "Uncategorized"),
@@ -149,9 +151,11 @@ export function useAIExtraction(inventory: Item[], onComplete: (itemData: any) =
min_quantity: 1.0,
box_label: data.box_label ? String(data.box_label) : null,
labels_data: JSON.stringify(data),
// Pass extracted image blob and image_processing metadata for auto-photo-save
extractedImageBlob,
imageProcessing: data.image_processing
// Only pass image blob if user approved it
...(skipPhoto ? {} : {
extractedImageBlob,
imageProcessing: data.image_processing
})
};
onComplete(newItem);
@@ -174,6 +178,8 @@ export function useAIExtraction(inventory: Item[], onComplete: (itemData: any) =
try {
for (let i = 0; i < itemsToProcess.length; i++) {
const data = itemsToProcess[i];
const skipPhoto = data._skipPhoto === true;
const newItem = {
name: String(data.Item || data.name || "New AI Item"),
category: String(data.Category || data.category || "Uncategorized"),
@@ -190,9 +196,11 @@ export function useAIExtraction(inventory: Item[], onComplete: (itemData: any) =
min_quantity: 1.0,
box_label: data.box_label ? String(data.box_label) : null,
labels_data: JSON.stringify(data),
// Pass extracted image blob and image_processing metadata for auto-photo-save
extractedImageBlob,
imageProcessing: data.image_processing
// Only pass image blob if user approved it
...(skipPhoto ? {} : {
extractedImageBlob,
imageProcessing: data.image_processing
})
};
await onComplete(newItem);
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB