diff --git a/src/components/SasquatchGuide.tsx b/src/components/SasquatchGuide.tsx index a3bb854..b20ff39 100644 --- a/src/components/SasquatchGuide.tsx +++ b/src/components/SasquatchGuide.tsx @@ -184,9 +184,11 @@ export function SasquatchGuide({ message, onDismiss }: SasquatchGuideProps) { })); history.push({ role: 'user', content: question }); - // 3. If user is logged in, use Shakespeare AI with streaming + // 3. If user is logged in, try Shakespeare AI (with graceful fallback) if (user && shakespeare.isAuthenticated) { let accumulated = ''; + let aiSucceeded = false; + try { // First pass: get AI response which may include a TOOL: call // Prefix the system prompt into the first user message for compatibility @@ -267,13 +269,24 @@ export function SasquatchGuide({ message, onDismiss }: SasquatchGuideProps) { accumulated = aiText; } - setStreamingText(''); - appendMessage({ - role: 'sasquatch', - text: accumulated || "Hmm, couldn't process that. Try rephrasing!", - timestamp: Date.now(), - isLive: !!toolMatch && cvmConnected === true, - }); + setStreamingText(''); + appendMessage({ + role: 'sasquatch', + text: accumulated || "Hmm, couldn't process that. Try rephrasing!", + timestamp: Date.now(), + isLive: !!toolMatch && cvmConnected === true, + }); + aiSucceeded = true; + } catch (aiErr) { + // AI failed — fall back to static FAQ silently + console.warn('[Sasquatch] AI unavailable, using static FAQ:', aiErr); + } + + if (!aiSucceeded) { + const fallback = staticAnswer ?? + "Couldn't reach the AI right now. Check the map for spots, The Lab for coaches, or ask again in a moment! 🛹"; + appendMessage({ role: 'sasquatch', text: fallback, timestamp: Date.now() }); + } } else { // 6. Not logged in — use static FAQ or generic fallback