mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-12 09:12:40 +02:00
Add AI status badges to show verification status on prices
- Add ai_status column to price_history table (verified/corrected/null)
- Track AI verification status through scraper and scheduler
- Display badges next to prices:
- ✓ AI (green): AI verified the price is correct
- ⚡ AI (orange): AI corrected an incorrect price
- Show badges on Dashboard product cards and ProductDetail page
- Add legend explaining badges in Settings when AI Verification is enabled
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
3d91489f12
commit
ccbc188487
11 changed files with 173 additions and 23 deletions
|
|
@ -62,8 +62,8 @@ router.post('/:productId/refresh', async (req: AuthRequest, res: Response) => {
|
|||
return;
|
||||
}
|
||||
|
||||
// Scrape product data including price and stock status
|
||||
const scrapedData = await scrapeProduct(product.url);
|
||||
// Scrape product data including price and stock status (pass userId for AI verification)
|
||||
const scrapedData = await scrapeProduct(product.url, userId);
|
||||
|
||||
// Update stock status and record change if different
|
||||
if (scrapedData.stockStatus !== product.stock_status) {
|
||||
|
|
@ -77,7 +77,8 @@ router.post('/:productId/refresh', async (req: AuthRequest, res: Response) => {
|
|||
newPrice = await priceHistoryQueries.create(
|
||||
productId,
|
||||
scrapedData.price.price,
|
||||
scrapedData.price.currency
|
||||
scrapedData.price.currency,
|
||||
scrapedData.aiStatus
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -90,6 +91,7 @@ router.post('/:productId/refresh', async (req: AuthRequest, res: Response) => {
|
|||
: 'Price refreshed successfully',
|
||||
price: newPrice,
|
||||
stockStatus: scrapedData.stockStatus,
|
||||
aiStatus: scrapedData.aiStatus,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error refreshing price:', error);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ router.post('/', async (req: AuthRequest, res: Response) => {
|
|||
await priceHistoryQueries.create(
|
||||
product.id,
|
||||
scrapedData.price.price,
|
||||
scrapedData.price.currency
|
||||
scrapedData.price.currency,
|
||||
scrapedData.aiStatus
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue