[2ff88f42] Finalize Pains & Gains Phase 2 + Matrix Engine v3.2 (Ops Secondary Logic)
This commit is contained in:
@@ -128,7 +128,7 @@ PERSÖNLICHE HERAUSFORDERUNGEN DES ANSPRECHPARTNERS (PAIN POINTS):
|
||||
}}
|
||||
|
||||
--- FORMAT ---
|
||||
Antworte NUR mit einem validen JSON-Objekt.
|
||||
Antworte NUR mit einem validen JSON-Objekt. Keine Markdown-Blöcke (```json), kein erklärender Text.
|
||||
Format:
|
||||
{{
|
||||
"subject": "...",
|
||||
@@ -231,9 +231,22 @@ def run_matrix_generation(dry_run: bool = True, force: bool = False, specific_in
|
||||
else:
|
||||
try:
|
||||
result = real_gemini_call(prompt)
|
||||
# Basic Validation
|
||||
if not result.get("subject") or not result.get("intro"):
|
||||
print(" -> Invalid result structure. Skipping.")
|
||||
|
||||
# Normalize Keys (Case-Insensitive)
|
||||
normalized_result = {}
|
||||
for k, v in result.items():
|
||||
normalized_result[k.lower()] = v
|
||||
|
||||
# Map known variations to standardized keys
|
||||
if "introduction_textonly" in normalized_result:
|
||||
normalized_result["intro"] = normalized_result["introduction_textonly"]
|
||||
if "industry_references_textonly" in normalized_result:
|
||||
normalized_result["social_proof"] = normalized_result["industry_references_textonly"]
|
||||
|
||||
# Validation using normalized keys
|
||||
if not normalized_result.get("subject") or not normalized_result.get("intro"):
|
||||
print(f" -> Invalid result structure. Keys found: {list(result.keys())}")
|
||||
print(f" -> Raw Result: {json.dumps(result, indent=2)}")
|
||||
continue
|
||||
|
||||
except Exception as e:
|
||||
@@ -246,16 +259,16 @@ def run_matrix_generation(dry_run: bool = True, force: bool = False, specific_in
|
||||
new_entry = MarketingMatrix(
|
||||
industry_id=ind.id,
|
||||
persona_id=pers.id,
|
||||
subject=result.get("subject"),
|
||||
intro=result.get("intro"),
|
||||
social_proof=result.get("social_proof")
|
||||
subject=normalized_result.get("subject"),
|
||||
intro=normalized_result.get("intro"),
|
||||
social_proof=normalized_result.get("social_proof")
|
||||
)
|
||||
db.add(new_entry)
|
||||
print(f" -> Created new entry.")
|
||||
else:
|
||||
existing.subject = result.get("subject")
|
||||
existing.intro = result.get("intro")
|
||||
existing.social_proof = result.get("social_proof")
|
||||
existing.subject = normalized_result.get("subject")
|
||||
existing.intro = normalized_result.get("intro")
|
||||
existing.social_proof = normalized_result.get("social_proof")
|
||||
print(f" -> Updated entry.")
|
||||
|
||||
db.commit()
|
||||
|
||||
Reference in New Issue
Block a user