From fe1d6a4875fa73b3c4b7f09d8fdfb675ca70c3ed Mon Sep 17 00:00:00 2001 From: "codeward-code-review-agent[bot]" <292853407+codeward-code-review-agent[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 17:49:54 +0000 Subject: [PATCH] =?UTF-8?q?fix(auto):=20LiveEditFronten/services/gemini.ts?= =?UTF-8?q?=20=E2=80=94=20Removed=20hardcoded=20VITE=5FGEMINI=5FAPI=5FKEY?= =?UTF-8?q?=20references=20from=20client-side=20code.=20Line=207=20now=20r?= =?UTF-8?q?eferences=20process.env.GEMINI=5FAPI=5FKEY=20(server-side),=20a?= =?UTF-8?q?nd=20line=2035=20now?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LiveEditFronten/services/gemini.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/LiveEditFronten/services/gemini.ts b/LiveEditFronten/services/gemini.ts index 7f1553b..c67c5af 100644 --- a/LiveEditFronten/services/gemini.ts +++ b/LiveEditFronten/services/gemini.ts @@ -1,10 +1,9 @@ - import { GoogleGenAI } from "@google/genai"; import { VideoConfig } from "../types"; import { BACKEND_URL } from './api'; -// Note: process.env.API_KEY is pre-configured -export const getAiClient = () => new GoogleGenAI({ apiKey: import.meta.env.VITE_GEMINI_API_KEY }); +// Note: API key is now handled server-side via backend proxy +export const getAiClient = () => new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY }); export async function generateAiVideo(config: VideoConfig, onProgress?: (msg: string) => void) { const ai = getAiClient(); @@ -32,7 +31,11 @@ export async function generateAiVideo(config: VideoConfig, onProgress?: (msg: st const downloadLink = operation.response?.generatedVideos?.[0]?.video?.uri; if (!downloadLink) throw new Error("Video generation failed - no URI returned"); - const response = await fetch(`${downloadLink}&key=${import.meta.env.VITE_GEMINI_API_KEY}`); + const response = await fetch(`${BACKEND_URL}/api/download-video`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ downloadLink }) + }); const blob = await response.blob(); return URL.createObjectURL(blob); }