CognxSafeTrack commited on
Commit
f0f0df4
·
1 Parent(s): 854ab32

fix(ai): add imageUrl field to Prisma schema and correctly route language selection inside whatsapp.ts

Browse files
Dockerfile CHANGED
@@ -41,7 +41,7 @@ EXPOSE 7860
41
  ENV PORT=7860
42
 
43
  # Force Docker cache invalidation - bump date to trigger clean rebuild
44
- ENV REBUILD_DATE="2026-03-01-v8-context-leak-fix"
45
 
46
  # SAFETY: Default to skipping DB push to prevent schema drift.
47
  # Only Railway (api service) should push schema — it overrides SKIP_DB_PUSH=false in its variables.
 
41
  ENV PORT=7860
42
 
43
  # Force Docker cache invalidation - bump date to trigger clean rebuild
44
+ ENV REBUILD_DATE="2026-03-01-v9-language-and-image-fixes"
45
 
46
  # SAFETY: Default to skipping DB push to prevent schema drift.
47
  # Only Railway (api service) should push schema — it overrides SKIP_DB_PUSH=false in its variables.
apps/api/src/services/whatsapp.ts CHANGED
@@ -201,6 +201,26 @@ export class WhatsAppService {
201
  }
202
  }
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  // 2. Check Pending Exercise (User Progress)
205
  // 2. Resolve sector LIST reply IDs → human-readable label
206
  const SECTOR_LABELS: Record<string, { fr: string; wo: string }> = {
 
201
  }
202
  }
203
 
204
+ // 1.7. Language Selection (Interactive Buttons)
205
+ if (normalizedText === 'LANG_FR' || normalizedText === 'LANG_WO') {
206
+ const newLang = normalizedText === 'LANG_FR' ? 'FR' : 'WOLOF';
207
+ user = await prisma.user.update({
208
+ where: { id: user.id },
209
+ data: { language: newLang }
210
+ });
211
+
212
+ const promptText = newLang === 'FR'
213
+ ? "Parfait, nous allons continuer en Français ! 🇫🇷\nDans quel domaine d'activité te trouves-tu ?"
214
+ : "Baax na, dinanu wéy ci Wolof ! 🇸🇳\nCi ban mbir ngay yëngu ?";
215
+
216
+ await scheduleInteractiveButtons(user.id, promptText, [
217
+ { id: 'SEC_COMMERCE', title: newLang === 'FR' ? 'Commerce / Vente' : 'Njaay / Commerce' },
218
+ { id: 'SEC_AGRI', title: newLang === 'FR' ? 'Agri / Élevage' : 'Mbay / Samm' },
219
+ { id: 'SEC_AUTRE', title: newLang === 'FR' ? 'Autre secteur' : 'Beneen mbir' }
220
+ ]);
221
+ return;
222
+ }
223
+
224
  // 2. Check Pending Exercise (User Progress)
225
  // 2. Resolve sector LIST reply IDs → human-readable label
226
  const SECTOR_LABELS: Record<string, { fr: string; wo: string }> = {
packages/database/prisma/schema.prisma CHANGED
@@ -75,6 +75,7 @@ model TrackDay {
75
  dayNumber Float
76
  title String?
77
  audioUrl String?
 
78
  videoUrl String?
79
  videoCaption String?
80
  lessonText String?
 
75
  dayNumber Float
76
  title String?
77
  audioUrl String?
78
+ imageUrl String?
79
  videoUrl String?
80
  videoCaption String?
81
  lessonText String?
packages/database/src/seed.ts CHANGED
@@ -65,6 +65,7 @@ async function syncTrackFile(prisma: PrismaClient, filePath: string) {
65
  exerciseCriteria: day.exerciseCriteria || null,
66
  badges: day.badges || null,
67
  audioUrl: day.audioUrl || null,
 
68
  videoUrl: day.videoUrl || null,
69
  videoCaption: day.videoCaption || null,
70
  buttonsJson: day.buttonsJson || null,
 
65
  exerciseCriteria: day.exerciseCriteria || null,
66
  badges: day.badges || null,
67
  audioUrl: day.audioUrl || null,
68
+ imageUrl: day.imageUrl || null,
69
  videoUrl: day.videoUrl || null,
70
  videoCaption: day.videoCaption || null,
71
  buttonsJson: day.buttonsJson || null,