feat: Multi-strategy price voting system with user selection

- Add multi-strategy voting: runs JSON-LD, site-specific, generic CSS,
  and AI extraction methods in parallel
- Implement consensus voting to select the correct price when methods agree
- Add AI arbitration when extraction methods disagree
- Add PriceSelectionModal for users to select correct price when ambiguous
- Store preferred extraction method per product for faster re-checks
- Add database columns for preferred_extraction_method and needs_price_review

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
clucraft 2026-01-24 14:45:51 -05:00
parent 40c45b49c8
commit 4fd04cd160
10 changed files with 1259 additions and 12 deletions

View file

@ -83,6 +83,27 @@ export interface ProductWithStats extends Product {
} | null;
}
// Response when product needs price review
export interface PriceCandidate {
price: number;
currency: string;
method: string;
context?: string;
confidence: number;
}
export interface PriceReviewResponse {
needsReview: true;
name: string | null;
imageUrl: string | null;
stockStatus: string;
priceCandidates: PriceCandidate[];
suggestedPrice: { price: number; currency: string } | null;
url: string;
}
export type CreateProductResponse = Product | PriceReviewResponse;
export interface PriceHistory {
id: number;
product_id: number;
@ -96,8 +117,13 @@ export const productsApi = {
getById: (id: number) => api.get<ProductWithStats>(`/products/${id}`),
create: (url: string, refreshInterval?: number) =>
api.post<Product>('/products', { url, refresh_interval: refreshInterval }),
create: (url: string, refreshInterval?: number, selectedPrice?: number, selectedMethod?: string) =>
api.post<CreateProductResponse>('/products', {
url,
refresh_interval: refreshInterval,
selectedPrice,
selectedMethod,
}),
update: (id: number, data: {
name?: string;