diff --git a/apps/Backend/src/ai/recall-graph.ts b/apps/Backend/src/ai/recall-graph.ts index ca6d5686..9d204670 100644 --- a/apps/Backend/src/ai/recall-graph.ts +++ b/apps/Backend/src/ai/recall-graph.ts @@ -328,6 +328,29 @@ const ASK_TIME_FALLBACKS: Record string> = { "Haitian Creole": (d) => `Bon, ki lè nan ${d} ki bon pou ou?`, }; +// Same follow-up question as ASK_TIME_FALLBACKS, without the leading "Great," +// greeting — used when it directly follows a rejection sentence, where the +// greeting would read as redundant filler. +const ASK_TIME_PLAIN_FALLBACKS: Record string> = { + English: (d) => `What time on ${d} works for you?`, + Spanish: (d) => `¿Qué hora le viene bien el ${d}?`, + Portuguese: (d) => `Que horário funciona para você em ${d}?`, + Mandarin: (d) => `您 ${d} 哪个时间方便?`, + Cantonese: (d) => `您 ${d} 邊個時間方便?`, + Arabic: (d) => `ما الوقت المناسب لك في ${d}؟`, + "Haitian Creole": (d) => `Ki lè nan ${d} ki bon pou ou?`, +}; + +const OFFICE_HOURS_ARE_FALLBACKS: Record = { + English: "Our office hours are", + Spanish: "Nuestro horario de atención es", + Portuguese: "Nosso horário de atendimento é", + Mandarin: "我们的营业时间是", + Cantonese: "我們嘅營業時間係", + Arabic: "ساعات عملنا هي", + "Haitian Creole": "Orè biwo nou se", +}; + const CLOSED_DAY_FALLBACKS: Record string> = { English: (day) => `We're closed on ${day}s. What other day works for you?`, Spanish: (day) => `Estamos cerrados los ${day}. ¿Qué otro día le viene bien?`, @@ -450,8 +473,9 @@ async function resolveDateTime( Arabic: `نحن غير متاحين في ذلك الوقت يوم ${dateLabel}.`, "Haitian Creole": `Nou pa disponib nan lè sa a nan ${dateLabel}.`, }; - const askTime = (ASK_TIME_FALLBACKS[lang] ?? ASK_TIME_FALLBACKS["English"]!)(dateLabel); - const hours = hoursDisplay ? ` ${hoursDisplay}.` : ""; + const askTime = (ASK_TIME_PLAIN_FALLBACKS[lang] ?? ASK_TIME_PLAIN_FALLBACKS["English"]!)(dateLabel); + const officeHoursAre = OFFICE_HOURS_ARE_FALLBACKS[lang] ?? OFFICE_HOURS_ARE_FALLBACKS["English"]!; + const hours = hoursDisplay ? ` ${officeHoursAre} ${hoursDisplay}.` : ""; return { reply: `${base[lang] ?? base["English"]}${hours} ${askTime}`, nextStage: "recall_asked_time_for_date" }; }