mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-24 14:15:15 +02:00
Add per-product AI extraction disable option
- Add ai_extraction_disabled column to products table - Add toggle in Advanced Settings alongside AI verification disable - Pass skipAiExtraction flag through scheduler to scraper - Skip AI extraction fallback when flag is set for product Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
0a66d55d79
commit
be6dd6382e
7 changed files with 49 additions and 6 deletions
|
|
@ -66,6 +66,7 @@ export interface Product {
|
|||
target_price: number | null;
|
||||
notify_back_in_stock: boolean;
|
||||
ai_verification_disabled: boolean;
|
||||
ai_extraction_disabled: boolean;
|
||||
created_at: string;
|
||||
current_price: number | null;
|
||||
currency: string | null;
|
||||
|
|
@ -133,6 +134,7 @@ export const productsApi = {
|
|||
target_price?: number | null;
|
||||
notify_back_in_stock?: boolean;
|
||||
ai_verification_disabled?: boolean;
|
||||
ai_extraction_disabled?: boolean;
|
||||
}) => api.put<Product>(`/products/${id}`, data),
|
||||
|
||||
delete: (id: number) => api.delete(`/products/${id}`),
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export default function ProductDetail() {
|
|||
const [targetPrice, setTargetPrice] = useState<string>('');
|
||||
const [notifyBackInStock, setNotifyBackInStock] = useState(false);
|
||||
const [aiVerificationDisabled, setAiVerificationDisabled] = useState(false);
|
||||
const [aiExtractionDisabled, setAiExtractionDisabled] = useState(false);
|
||||
|
||||
const REFRESH_INTERVALS = [
|
||||
{ value: 300, label: '5 minutes' },
|
||||
|
|
@ -64,6 +65,7 @@ export default function ProductDetail() {
|
|||
}
|
||||
setNotifyBackInStock(productRes.data.notify_back_in_stock || false);
|
||||
setAiVerificationDisabled(productRes.data.ai_verification_disabled || false);
|
||||
setAiExtractionDisabled(productRes.data.ai_extraction_disabled || false);
|
||||
} catch {
|
||||
setError('Failed to load product details');
|
||||
} finally {
|
||||
|
|
@ -142,6 +144,7 @@ export default function ProductDetail() {
|
|||
target_price: target,
|
||||
notify_back_in_stock: notifyBackInStock,
|
||||
ai_verification_disabled: aiVerificationDisabled,
|
||||
ai_extraction_disabled: aiExtractionDisabled,
|
||||
});
|
||||
setProduct({
|
||||
...product,
|
||||
|
|
@ -149,6 +152,7 @@ export default function ProductDetail() {
|
|||
target_price: target,
|
||||
notify_back_in_stock: notifyBackInStock,
|
||||
ai_verification_disabled: aiVerificationDisabled,
|
||||
ai_extraction_disabled: aiExtractionDisabled,
|
||||
});
|
||||
showToast('Notification settings saved');
|
||||
} catch {
|
||||
|
|
@ -854,6 +858,18 @@ export default function ProductDetail() {
|
|||
</p>
|
||||
|
||||
<label className="advanced-checkbox-group">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={aiExtractionDisabled}
|
||||
onChange={(e) => setAiExtractionDisabled(e.target.checked)}
|
||||
/>
|
||||
<div className="advanced-checkbox-label">
|
||||
<span>Disable AI Extraction</span>
|
||||
<span>Prevent AI from being used as a fallback when standard scraping fails to find a price. Useful if AI keeps extracting wrong prices.</span>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<label className="advanced-checkbox-group" style={{ marginTop: '0.75rem' }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={aiVerificationDisabled}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue