feat: improve AI resilience, add background enrichment loading states, and fix duplicate identifier in TagSelector
This commit is contained in:
@@ -3,6 +3,7 @@ import { z } from 'zod';
|
||||
export const BottleMetadataSchema = z.object({
|
||||
name: z.string().trim().min(1).max(255).nullish(),
|
||||
distillery: z.string().trim().max(255).nullish(),
|
||||
bottler: z.string().trim().max(255).nullish(),
|
||||
category: z.string().trim().max(100).nullish(),
|
||||
abv: z.number().min(0).max(100).nullish(),
|
||||
age: z.number().min(0).max(100).nullish(),
|
||||
@@ -76,12 +77,12 @@ export type AdminSettingsData = z.infer<typeof AdminSettingsSchema>;
|
||||
|
||||
export const DiscoveryDataSchema = z.object({
|
||||
name: z.string().trim().min(1).max(255),
|
||||
distillery: z.string().trim().max(255).optional(),
|
||||
abv: z.number().min(0).max(100).optional(),
|
||||
age: z.number().min(0).max(100).optional(),
|
||||
distilled_at: z.string().trim().max(50).optional(),
|
||||
bottled_at: z.string().trim().max(50).optional(),
|
||||
batch_info: z.string().trim().max(255).optional(),
|
||||
distillery: z.string().trim().max(255).nullish(),
|
||||
abv: z.number().min(0).max(100).nullish(),
|
||||
age: z.number().min(0).max(100).nullish(),
|
||||
distilled_at: z.string().trim().max(50).nullish(),
|
||||
bottled_at: z.string().trim().max(50).nullish(),
|
||||
batch_info: z.string().trim().max(255).nullish(),
|
||||
});
|
||||
|
||||
export type DiscoveryData = z.infer<typeof DiscoveryDataSchema>;
|
||||
@@ -96,10 +97,25 @@ export interface AnalysisResponse {
|
||||
success: boolean;
|
||||
data?: BottleMetadata;
|
||||
error?: string;
|
||||
isAiError?: boolean;
|
||||
imageHash?: string;
|
||||
perf?: {
|
||||
apiDuration: number;
|
||||
parseDuration: number;
|
||||
// Legacy fields (kept for backward compatibility)
|
||||
apiDuration?: number;
|
||||
parseDuration?: number;
|
||||
|
||||
// Detailed metrics
|
||||
imagePrep?: number;
|
||||
cacheCheck?: number;
|
||||
encoding?: number;
|
||||
modelInit?: number;
|
||||
apiCall?: number;
|
||||
parsing?: number;
|
||||
validation?: number;
|
||||
dbOps?: number;
|
||||
uploadSize: number;
|
||||
total?: number;
|
||||
cacheHit?: boolean;
|
||||
};
|
||||
raw?: any;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user