TheDocumentation 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.
/api/chat route powers Sally’s conversational AI throughout the virtual office. It accepts the current message history and an optional room context object, builds a contextual system prompt from the base SALLY_SYSTEM_PROMPT constant, and streams token-by-token responses from Google Gemini 2.5 Flash using the Vercel AI SDK’s streamText helper. The response is returned as a UIMessageStreamResponse that the client-side useChat hook consumes directly.
Request
| Property | Value |
|---|---|
| Method | POST |
| Path | /api/chat |
| Content-Type | application/json |
Body Parameters
The full conversation history in Vercel AI SDK
UIMessage format. Each element must carry a role ("user" or "assistant") and a content string. The array is passed through convertToModelMessages() before being forwarded to the model.Optional context object that is appended to the system prompt to personalise Sally’s responses for the current session.
Response
A successful call returns a Server-Sent Events stream (text/event-stream) in the Vercel AI SDK UIMessageStream format. The calling component typically consumes this via useChat and never needs to parse the raw stream manually.
| Property | Value |
|---|---|
| Content-Type | text/event-stream |
| Format | Vercel AI SDK UIMessageStream |
Configuration
The route callsstreamText with the following parameters, exactly as they appear in app/api/chat/route.ts:
| Parameter | Value | Notes |
|---|---|---|
model | google/gemini-2.5-flash | Served via Vercel AI Gateway |
maxOutputTokens | 500 | Keeps responses concise for chat UI |
temperature | 0.7 | Balanced creativity / accuracy |
abortSignal | req.signal | Cancels stream if the client disconnects |
System Prompt
Sally’s personality and knowledge base are defined inSALLY_SYSTEM_PROMPT, exported from lib/constants.ts. Before the prompt is sent to the model, the route appends a dynamic context block:
"lobby" and "Visitante" are used.
Example Request
Error Responses
| Status | Description |
|---|---|
500 | Error processing the message — Gemini API unavailable or GOOGLE_GEMINI_API_KEY not set |