Task : Notifications async pour jobs longs
Date : 01/02/2026
Status : EN COURS
Fichiers crees
connectors-api/migrations/018_unread_and_background_jobs.sql - Table ai_background_jobs + colonne has_unread
connectors-api/src/services/notify.ts - Helper push notification via notif-logger
Fichiers modifies
Backend (connectors-api)
src/services/intentExecutor.ts :
- Ajout LONG_JOB_TOOLS = ['wan21', 'sadtalker', 'facefusion', 'applio']
- Bifurcation : jobs longs → submit avec callback_url, pas de polling
- Tracking dans ai_background_jobs
- Ajout param userMessageId a executeIntent et executeAiJobIntent
src/services/aiChat.ts :
- Export de uploadJobOutputToStorage (pour le webhook)
- Gestion retour background: true → message placeholder immediat
src/index.ts :
- Route POST /api/ai/webhook/job-complete (webhook callback)
- Route POST /api/ai/conversations/:id/mark-read
Frontend (connectors-front)
src/components/ai/ChatConversationList.tsx : Interface + badge unread
src/components/ai/AiChatSidebar.tsx : Polling 30s pour detecter nouveaux badges
src/routes/chat/[id]/index.tsx : Mark-read a l'ouverture
src/lib/api.ts : Methode markConversationRead()
Prochaines etapes
- [ ] Lancer migration 018 sur Supabase
- [ ] Git push connectors-api
- [ ] Git push connectors-front
- [ ] Tester avec un job wan21
- [ ] Configurer AI_WEBHOOK_SECRET dans l'env si souhaite