fix: simplify gemini token endpoint to avoid SDK instantiation errors
All checks were successful
Build & Push / build-and-push (push) Successful in 1m42s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-28 13:52:11 +01:00
parent bab45b981e
commit d1d5b7e124

View File

@@ -1,4 +1,4 @@
import { GoogleGenAI, Type } from '@google/genai';
import { Type } from '@google/genai';
// ─── Constants ────────────────────────────────────────────────────────────────
@@ -152,13 +152,7 @@ export function buildLiveConfig(locale: string) {
// ─── Ephemeral Token ──────────────────────────────────────────────────────────
export async function generateEphemeralToken(locale: string) {
// GoogleGenAI is instantiated here to validate the API key at request time.
// The SDK does not yet expose an ephemeral token API; in production, replace
// this with ai.auth.tokens.create() or equivalent when available to avoid
// exposing the API key to the client.
new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY! });
export function generateEphemeralToken(locale: string) {
const config = buildLiveConfig(locale);
return { config, model: GEMINI_LIVE_MODEL };
}