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