[31388f42] Fix Gemini API Key path resolution for Docker environment
This commit is contained in:
@@ -25,13 +25,21 @@ import json
|
||||
|
||||
# --- Helper: Get Gemini Key ---
|
||||
def get_gemini_key():
|
||||
try:
|
||||
key_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gemini_api_key.txt')
|
||||
if os.path.exists(key_path):
|
||||
with open(key_path, 'r') as f:
|
||||
return f.read().strip()
|
||||
except:
|
||||
pass
|
||||
candidates = [
|
||||
"gemini_api_key.txt", # Current dir
|
||||
"/app/gemini_api_key.txt", # Docker default
|
||||
os.path.join(os.path.dirname(__file__), "gemini_api_key.txt"), # Script dir
|
||||
os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gemini_api_key.txt') # Parent dir
|
||||
]
|
||||
|
||||
for path in candidates:
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
with open(path, 'r') as f:
|
||||
return f.read().strip()
|
||||
except:
|
||||
pass
|
||||
|
||||
return os.getenv("GEMINI_API_KEY")
|
||||
|
||||
def extract_role_with_llm(name, company, search_results):
|
||||
|
||||
Reference in New Issue
Block a user