[31388f42] Fix Gemini API Key path resolution for Docker environment
This commit is contained in:
@@ -4,14 +4,21 @@ import requests
|
||||
|
||||
# Load API Key
|
||||
def get_gemini_key():
|
||||
try:
|
||||
# Try finding key in parent dir
|
||||
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 generate_email_draft(lead_data, company_data, booking_link="https://outlook.office365.com/owa/calendar/RoboplanetGmbH@robo-planet.de/bookings/"):
|
||||
@@ -37,6 +44,7 @@ def generate_email_draft(lead_data, company_data, booking_link="https://outlook.
|
||||
area = meta.get('area', 'Unbekannte Fläche')
|
||||
purpose = meta.get('purpose', 'Reinigung')
|
||||
city = meta.get('city', '')
|
||||
role = meta.get('role', 'Unbekannt')
|
||||
|
||||
# Data from Company Explorer
|
||||
ce_summary = company_data.get('summary', 'Keine Details verfügbar.')
|
||||
@@ -54,15 +62,18 @@ def generate_email_draft(lead_data, company_data, booking_link="https://outlook.
|
||||
- Branche/Vertical: {ce_vertical}
|
||||
- Web-Zusammenfassung: {ce_summary}
|
||||
|
||||
ANSPRECHPARTNER:
|
||||
- Name: {contact_name}
|
||||
- Rolle/Position: {role} (WICHTIG: Nutze dieses Wissen für den Tonfall. Ein Geschäftsführer braucht Argumente zu ROI/Effizienz, ein Facility Manager zu Operativem/Handling.)
|
||||
|
||||
ANFRAGE-DETAILS (Vom Kunden):
|
||||
- Reinigungsfläche: {area}
|
||||
- Einsatzzweck: {purpose}
|
||||
- Kontaktperson: {contact_name}
|
||||
|
||||
DEIN ZIEL:
|
||||
Schreibe eine kurze, prägnante und wertschätzende E-Mail.
|
||||
1. Bedanke dich für die Anfrage.
|
||||
2. Zeige kurz, dass du verstanden hast, was die Firma macht (nutze den Kontext aus 'Web-Zusammenfassung' in einem Satz, z.B. "Als führender Anbieter von xyz...").
|
||||
2. Zeige kurz, dass du verstanden hast, was die Firma macht.
|
||||
3. Gehe auf die Fläche ({area}) ein.
|
||||
- Wenn > 1000qm oder Industrie/Halle: Erwähne den "Puma M20" oder "Scrubber 75" als Kraftpaket.
|
||||
- Wenn < 1000qm oder Büro/Praxis/Gastro: Erwähne den "Phantas" oder "Pudu CC1" als wendige Lösung.
|
||||
|
||||
@@ -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