Add AI-powered price extraction fallback

- Add AI extraction service supporting Anthropic (Claude) and OpenAI
- Add AI settings UI in Settings page with provider selection
- Add database migration for AI settings columns
- Integrate AI fallback into scraper when standard methods fail
- Add API endpoints for AI settings and test extraction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
clucraft 2026-01-21 21:49:55 -05:00
parent cfca33b4ea
commit d98138fe7c
11 changed files with 887 additions and 10 deletions

View file

@ -143,8 +143,39 @@ export const settingsApi = {
testDiscord: () =>
api.post<{ message: string }>('/settings/notifications/test/discord'),
// AI Settings
getAI: () =>
api.get<AISettings>('/settings/ai'),
updateAI: (data: {
ai_enabled?: boolean;
ai_provider?: 'anthropic' | 'openai' | null;
anthropic_api_key?: string | null;
openai_api_key?: string | null;
}) => api.put<AISettings & { message: string }>('/settings/ai', data),
testAI: (url: string) =>
api.post<AITestResult>('/settings/ai/test', { url }),
};
// AI Settings types
export interface AISettings {
ai_enabled: boolean;
ai_provider: 'anthropic' | 'openai' | null;
anthropic_configured: boolean;
openai_configured: boolean;
}
export interface AITestResult {
success: boolean;
name: string | null;
price: { price: number; currency: string } | null;
imageUrl: string | null;
stockStatus: string;
confidence: number;
}
// Profile API
export interface UserProfile {
id: number;