install dotenv

This commit is contained in:
Nick
2025-10-27 19:29:18 +01:00
parent 49964c20a6
commit 20887ee5a1
3 changed files with 7 additions and 2 deletions

1
.env Normal file
View File

@@ -0,0 +1 @@
GEMINI_API_KEY='AIzaSyCdjM5XE0hv9O1Ecx-uspvI8UInSzK1U9M'

View File

@@ -14,6 +14,9 @@ from typing import List, Optional
from google import genai from google import genai
from google.genai import types from google.genai import types
from dotenv import load_dotenv
load_dotenv()
# Configurazione mixer # Configurazione mixer
DEFAULT_HOST = "192.168.1.62" DEFAULT_HOST = "192.168.1.62"
DEFAULT_PORT = 49280 DEFAULT_PORT = 49280
@@ -479,7 +482,7 @@ class TF5AIAgent:
self.controller = TF5MixerController(mixer_host, mixer_port) self.controller = TF5MixerController(mixer_host, mixer_port)
# Configura il client Gemini # Configura il client Gemini
api_key = 'AIzaSyCdjM5XE0hv9O1Ecx-uspvI8UInSzK1U9M' api_key = os.getenv("GEMINI_API_KEY")
if not api_key: if not api_key:
raise ValueError("GEMINI_API_KEY non trovata nelle variabili d'ambiente") raise ValueError("GEMINI_API_KEY non trovata nelle variabili d'ambiente")
@@ -620,7 +623,7 @@ def main():
args = parser.parse_args() args = parser.parse_args()
# Verifica che la API key sia impostata # Verifica che la API key sia impostata
if not 'AIzaSyCdjM5XE0hv9O1Ecx-uspvI8UInSzK1U9M': if not os.getenv("GEMINI_API_KEY"):
print("❌ Errore: GEMINI_API_KEY non trovata nelle variabili d'ambiente") print("❌ Errore: GEMINI_API_KEY non trovata nelle variabili d'ambiente")
print("\nPer impostare la chiave API:") print("\nPer impostare la chiave API:")
print(" export GEMINI_API_KEY='la-tua-chiave-api'") print(" export GEMINI_API_KEY='la-tua-chiave-api'")

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
dotenv