|
|
@@ -12,6 +12,7 @@ import time
|
|
|
from typing import Any, List, Dict, Optional
|
|
|
|
|
|
from google import genai
|
|
|
+from dotenv import load_dotenv
|
|
|
|
|
|
from src.utils.logger import get_logger
|
|
|
from src.utils.json_extractor import JSONExtractor
|
|
|
@@ -30,6 +31,7 @@ def _get_client():
|
|
|
"""获取 Gemini Client 实例"""
|
|
|
global _client
|
|
|
if _client is None:
|
|
|
+ load_dotenv()
|
|
|
api_key = os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY")
|
|
|
if not api_key:
|
|
|
raise ValueError("GEMINI_API_KEY or GOOGLE_API_KEY not found in environment")
|