Sally is the floating AI chat widget embedded on every page of the GCS Consultores Empresariales website. She acts as a virtual host — greeting visitors, understanding their business needs, and directing them to the most relevant Strategic Center or service area. Technically, Sally is a client-side React component (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/gcsconsultores/gcs-website/llms.txt
Use this file to discover all available pages before exploring further.
SallyChat) that streams responses from a Next.js Route Handler (/api/sally) using the Vercel AI SDK. The language model is Google Gemini 3 Flash, accessed through the Vercel AI Gateway with zero additional configuration.
Architecture Overview
User opens the chat widget
The floating launcher button renders at
fixed bottom-5 right-5. Clicking it calls handleOpen(), which sets open = true and fires trackEvent('sally_opened').User types or selects a quick reply
The
send() function calls sendMessage({ text: value }) from useChat and fires trackEvent('sally_message_sent'). Quick replies are pre-wired strings shown before the first user message.Request reaches the Route Handler
POST /api/sally receives the UIMessage[] array, calls convertToModelMessages(messages) to translate the AI SDK format, and passes it to streamText.The SALLY_MODEL Constant
Sally’s Personality (System Prompt)
Sally’s behavior is entirely defined bySALLY_SYSTEM_PROMPT in app/api/sally/route.ts. The full prompt:
Mission Objectives
| # | Objective |
|---|---|
| 1 | Welcome and orient visitors to the GCS website |
| 2 | Understand the visitor’s need and direct them to the right Strategic Center or service |
| 3 | Encourage scheduling a free Orientación Estratégica via the contact form |
Rules Sally Must Follow
- If asked anything outside the consulting/business domain, redirect politely back to GCS’s purpose.
- If a contracting or quoting intent is detected, direct the user to the Orientación Estratégica form or to
info@consultoresgcs.com. - Never invent prices or contractual timelines — defer to a human consultant.
- Never request unnecessary sensitive data.
Quick Replies
Three pre-defined quick-reply buttons are shown in the chat panel before the user sends their first message. They lower the friction of the first interaction by offering the most common visitor intents:send(q) directly, which invokes sendMessage and hides the quick-reply buttons (they only render when messages.length === 0).
The getMessageText() Helper
The AI SDK’sUIMessage type uses a parts array rather than a single content string. getMessageText() extracts the plain text from all text-type parts:
<ChatBubble>:
Analytics Events
Sally fires two custom analytics events via the sharedtrackEvent utility from lib/analytics:
| Event | Trigger | Payload |
|---|---|---|
sally_opened | User clicks the floating launcher button | (none) |
sally_message_sent | User sends any message (typed or quick reply) | (none) |
Route Handler Configuration
Switching to a Fine-Tuned Model
When GCS has a fine-tuned Gemini model trained on its own knowledge base, update the
SALLY_MODEL constant in app/api/sally/route.ts to the new model identifier. If the fine-tuned model is hosted on a custom endpoint outside the Vercel AI Gateway, you will also need to update the model argument in streamText to use the appropriate provider client instead of the gateway string.