mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-15 10:52:36 +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
|
|
@ -326,6 +326,7 @@ export interface Product {
|
|||
target_price: number | null;
|
||||
notify_back_in_stock: boolean;
|
||||
ai_verification_disabled: boolean;
|
||||
ai_extraction_disabled: boolean;
|
||||
created_at: Date;
|
||||
}
|
||||
|
||||
|
|
@ -490,6 +491,7 @@ export const productQueries = {
|
|||
target_price?: number | null;
|
||||
notify_back_in_stock?: boolean;
|
||||
ai_verification_disabled?: boolean;
|
||||
ai_extraction_disabled?: boolean;
|
||||
}
|
||||
): Promise<Product | null> => {
|
||||
const fields: string[] = [];
|
||||
|
|
@ -520,6 +522,10 @@ export const productQueries = {
|
|||
fields.push(`ai_verification_disabled = $${paramIndex++}`);
|
||||
values.push(updates.ai_verification_disabled);
|
||||
}
|
||||
if (updates.ai_extraction_disabled !== undefined) {
|
||||
fields.push(`ai_extraction_disabled = $${paramIndex++}`);
|
||||
values.push(updates.ai_extraction_disabled);
|
||||
}
|
||||
|
||||
if (fields.length === 0) return null;
|
||||
|
||||
|
|
@ -607,6 +613,14 @@ export const productQueries = {
|
|||
);
|
||||
return result.rows[0]?.ai_verification_disabled === true;
|
||||
},
|
||||
|
||||
isAiExtractionDisabled: async (id: number): Promise<boolean> => {
|
||||
const result = await pool.query(
|
||||
'SELECT ai_extraction_disabled FROM products WHERE id = $1',
|
||||
[id]
|
||||
);
|
||||
return result.rows[0]?.ai_extraction_disabled === true;
|
||||
},
|
||||
};
|
||||
|
||||
// Price History types and queries
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue