Merge pull request #3 from Tony0410/codex/update-geminiservice-to-use-vite_api_key
Use Vite env variable for Gemini key
This commit is contained in:
@@ -3,10 +3,14 @@ import { VoiceName } from '../types';
|
||||
import { normalizeUrl } from '../utils/url';
|
||||
|
||||
const getAiClient = () => {
|
||||
const apiKey = process.env.API_KEY;
|
||||
const apiKey = import.meta.env.VITE_API_KEY;
|
||||
|
||||
if (!apiKey) {
|
||||
throw new Error("API Key is missing");
|
||||
throw new Error(
|
||||
"Gemini API key is missing. Set VITE_API_KEY in your .env.local file (e.g., VITE_API_KEY=your_key_here)."
|
||||
);
|
||||
}
|
||||
|
||||
return new GoogleGenAI({ apiKey });
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user