feat: improve AI resilience, add background enrichment loading states, and fix duplicate identifier in TagSelector
This commit is contained in:
24
src/utils/generate-dummy-metadata.ts
Normal file
24
src/utils/generate-dummy-metadata.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user