bugfix
This commit is contained in:
@@ -1559,13 +1559,14 @@ def evaluate_branche_chatgpt(crm_branche, beschreibung, wiki_branche, wiki_kateg
|
||||
# Lade Mapping und Liste der erlaubten Ziel-Branchen
|
||||
mapping, allowed_branches = load_target_branches()
|
||||
|
||||
# Baue den Text für das Ziel-Branchenschema, der im System-Prompt an ChatGPT übergeben wird
|
||||
schema_lines = ["Ziel-Branchenschema: Folgende Branchenbereiche sind gültig:"]
|
||||
for branch in allowed_branches:
|
||||
schema_lines.append(f"- {branch}")
|
||||
target_schema_info = "\n".join(schema_lines)
|
||||
|
||||
# Erstelle den System-Prompt inklusive der Zielvorgaben
|
||||
# Baue den Text für das Ziel-Branchenschema, der im System-Prompt an ChatGPT übergeben wird
|
||||
schema_lines = ["Ziel-Branchenschema: Folgende Branchenbereiche sind gültig:"]
|
||||
for branch in allowed_branches:
|
||||
schema_lines.append(f"- {branch}")
|
||||
target_schema_info = "\n".join(schema_lines)
|
||||
|
||||
# Erstelle den System-Prompt inklusive der Zielvorgaben. Hier wird das Zielbranchenschema aus der CSV-Datei
|
||||
# (via load_target_schema) eingebunden.
|
||||
target_mapping, target_schema_string, allowed_targets = load_target_schema()
|
||||
|
||||
prompt = (
|
||||
@@ -1580,14 +1581,15 @@ prompt = (
|
||||
"Branche: <vorgeschlagene Branche>\n"
|
||||
"Übereinstimmung: <ok oder X>\n"
|
||||
"Begründung: <kurze Begründung>"
|
||||
)
|
||||
try:
|
||||
with open("api_key.txt", "r") as f:
|
||||
api_key = f.read().strip()
|
||||
except Exception as e:
|
||||
debug_print(f"Fehler beim Lesen des API-Tokens für Brancheneinschätzung: {e}")
|
||||
return {"branch": crm_branche, "consistency": "X", "justification": "API-Key Fehler"}
|
||||
openai.api_key = api_key
|
||||
)
|
||||
|
||||
try:
|
||||
with open("api_key.txt", "r") as f:
|
||||
api_key = f.read().strip()
|
||||
except Exception as e:
|
||||
debug_print(f"Fehler beim Lesen des API-Tokens für Brancheneinschätzung: {e}")
|
||||
return {"branch": crm_branche, "consistency": "X", "justification": "API-Key Fehler"}
|
||||
openai.api_key = api_key
|
||||
try:
|
||||
response = openai.ChatCompletion.create(
|
||||
model=Config.TOKEN_MODEL,
|
||||
|
||||
Reference in New Issue
Block a user