feat: improve AI resilience, add background enrichment loading states, and fix duplicate identifier in TagSelector

This commit is contained in:
2025-12-23 11:38:16 +01:00
parent 1d98bb9947
commit c134c78a2c
37 changed files with 1906 additions and 786 deletions

View File

@@ -0,0 +1,24 @@
import { BottleMetadata } from '@/types/whisky';
/**
* Generate placeholder metadata for offline scans.
* Returns editable dummy data that user can fill in manually.
*/
export function generateDummyMetadata(imageFile: File): BottleMetadata {
return {
name: '', // Empty - user must fill in
distillery: '', // Empty - user must fill in
category: 'Whisky',
is_whisky: true,
confidence: 0,
abv: null,
age: null,
vintage: null,
bottler: null,
batch_info: null,
bottleCode: null,
distilled_at: null,
bottled_at: null,
whiskybaseId: null,
};
}

View File

@@ -47,7 +47,8 @@ export async function processImageForAI(file: File): Promise<ProcessedImage> {
maxSizeMB: 0.4,
maxWidthOrHeight: 1024,
useWebWorker: true,
fileType: 'image/webp'
fileType: 'image/webp',
libURL: '/lib/browser-image-compression.js'
};
try {