Sally’s chat functionality is powered by Google Gemini 2.5 Flash, accessed through the Vercel AI SDK’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/gcsconsultores/centros-estrategicos-gcs/llms.txt
Use this file to discover all available pages before exploring further.
streamText function. The /api/chat route receives a conversation history and an optional context object, builds a context-aware system prompt by combining the global SALLY_SYSTEM_PROMPT constant with the visitor’s current room and name, then streams the model’s response token-by-token back to the client as a Vercel AI UIMessageStream. This produces the real-time typing effect visible in Sally’s chat panel across all salas.
Setup
Get a Google Gemini API key
Visit Google AI Studio and create a new API key. No billing is required to get started — the Gemini API includes a free tier.
Configuration
The/api/chat route calls streamText with the following parameters. These values are defined directly in app/api/chat/route.ts:
abortSignal is forwarded from the incoming request so that if the user closes the chat panel mid-stream, the model call is cancelled immediately and no further tokens are billed.
Model Parameters
| Parameter | Value | Effect |
|---|---|---|
model | google/gemini-2.5-flash | Fast, capable Gemini model optimized for chat use cases |
maxOutputTokens | 500 | Keeps Sally’s responses concise and suited to a chat UX |
temperature | 0.7 | Balanced: professional and consistent, yet natural in tone |
maxDuration | 30 | Vercel serverless function timeout for the /api/chat route |
System Prompt Customization
Sally’s personality, expertise, tone, and objectives are all defined in theSALLY_SYSTEM_PROMPT constant in lib/constants.ts. To change how Sally behaves — her language, the services she recommends, or her escalation behavior — edit this constant directly.
At request time, additional context is injected dynamically after the base prompt to make Sally aware of where the visitor is and who they are:
- Use formal
ustedaddress in Spanish - Guide visitors toward a concrete action (diagnostic, meeting, or contact)
- Recommend the appropriate sala based on the visitor’s needs
- Never invent prices or specific timelines — escalate to a human consultant instead
SALLY_GREETINGS record in lib/constants.ts, which initializes the chat panel when a visitor enters a new room.
Vercel AI SDK Imports
The/api/chat route uses three named exports from the ai package:
| Import | Purpose |
|---|---|
streamText | Initiates a streaming LLM call and returns a result object with a toUIMessageStreamResponse() helper |
convertToModelMessages | Converts the Vercel AI SDK’s UIMessage[] format into the model-compatible message format expected by the provider |
UIMessage | TypeScript type for the Vercel AI SDK message shape, used to type the messages field in the request body |