Support Chat Gemini Model Repair Design¶
Context¶
Support-chat generation currently defaults to gemini-3.1-flash-lite-preview. Vertex AI does not expose that model ID, so both query normalization and final answer generation receive 404 NOT_FOUND. Google documents the supported model ID as gemini-3.1-flash-lite, with availability through the global location.
The user has already updated GEMINI_MODEL and GEMINI_LOCATION in the local ignored variables.env file and in the Vercel Production and Preview environments. This repository change prevents future deployments and setup instructions from restoring the invalid model ID.
Scope¶
- Change the runtime fallback model in
api/_lib/env.tstogemini-3.1-flash-lite. - Update all tracked test fixtures and endpoint expectations that contain the invalid model ID.
- Add regression coverage for the default model and generated global Vertex endpoint.
- Correct the Vercel environment-variable table in
README_SUPPORT_CHAT.md. - Add a troubleshooting entry for Vertex model
404 NOT_FOUNDresponses. - Keep
GEMINI_MODELconfigurable and keepGEMINI_LOCATIONdefaulted toglobal.
Out of Scope¶
- Changing live Vercel environment variables or triggering a deployment.
- Adding automatic model aliases, retries, or fallback models.
- Changing RAG retrieval, prompts, client rendering, or other support-chat behavior.
- Running browser or server tests.
Runtime Behavior¶
When GEMINI_MODEL is absent, the API will call the supported gemini-3.1-flash-lite model. When it is present, the configured value will still be used unchanged. The endpoint remains https://aiplatform.googleapis.com/v1/projects/{project}/locations/global/publishers/google/models/{model}:streamGenerateContent?alt=sse when GEMINI_LOCATION=global.
No automatic fallback will be added. A model configuration error will remain visible in structured Vercel logs instead of being hidden by an implicit retry to a different model.
Testing¶
- Update or add a unit expectation for the supported default model and run it before implementation to confirm it fails against the current runtime default.
- Update the Gemini endpoint test so it expects
gemini-3.1-flash-liteat the global endpoint. - Implement the runtime default correction.
- Run the focused environment and Gemini unit tests.
- Run the complete Vitest suite and TypeScript type checking.
Browser and server tests will not be run.
Deployment Note¶
The repository fix takes effect after the corrected code is deployed. The live Vercel variables should remain set to GEMINI_MODEL=gemini-3.1-flash-lite and GEMINI_LOCATION=global for both Production and Preview.