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

@ -551,6 +551,21 @@ export const productQueries = {
);
return result.rows;
},
updateExtractionMethod: async (id: number, method: string): Promise<void> => {
await pool.query(
'UPDATE products SET preferred_extraction_method = $1, needs_price_review = false WHERE id = $2',
[method, id]
);
},
getPreferredExtractionMethod: async (id: number): Promise<string | null> => {
const result = await pool.query(
'SELECT preferred_extraction_method FROM products WHERE id = $1',
[id]
);
return result.rows[0]?.preferred_extraction_method || null;
},
};
// Price History types and queries