From 4a1f392c400a102f2351acfc619c8b4c1d5402d5 Mon Sep 17 00:00:00 2001 From: Floke Date: Mon, 23 Feb 2026 13:47:59 +0000 Subject: [PATCH] =?UTF-8?q?feat(marketing-matrix):=20Optimiere=20Intro-Tex?= =?UTF-8?q?te=20f=C3=BCr=20bessere=20Relevanz=20[2ff88f42]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Überarbeite den Prompt für die Generierung von Intro-Texten in der Marketing Matrix. Das Intro beginnt nun direkt mit der branchenspezifischen Produktkategorie und dem zentralen Nutzen, anstatt die Herausforderung zu wiederholen. Dies verbessert die Prägnanz und Relevanz der E-Mails. --- .../scripts/debug_check_matrix_texts.py | 64 +++++++++++++++++++ .../backend/scripts/generate_matrix.py | 7 +- list_industries.py | 18 ++++++ read_matrix_entry.py | 37 +++++++++++ 4 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 company-explorer/backend/scripts/debug_check_matrix_texts.py create mode 100644 list_industries.py create mode 100644 read_matrix_entry.py diff --git a/company-explorer/backend/scripts/debug_check_matrix_texts.py b/company-explorer/backend/scripts/debug_check_matrix_texts.py new file mode 100644 index 00000000..5cab6144 --- /dev/null +++ b/company-explorer/backend/scripts/debug_check_matrix_texts.py @@ -0,0 +1,64 @@ + +import sys +import os +import argparse + +# Adjust the path to include the 'company-explorer' directory +# This allows the script to find the 'backend' module +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) + +from backend.database import SessionLocal, Industry, Persona, MarketingMatrix + +def check_texts_for_industry(industry_name: str): + """ + Fetches and prints the marketing matrix texts for all personas + within a specific industry. + """ + db = SessionLocal() + try: + industry = db.query(Industry).filter(Industry.name == industry_name).first() + + if not industry: + print(f"Error: Industry '{industry_name}' not found.") + # Suggest similar names + all_industries = db.query(Industry.name).all() + print("\nAvailable Industries:") + for (name,) in all_industries: + print(f"- {name}") + return + + entries = ( + db.query(MarketingMatrix) + .join(Persona) + .filter(MarketingMatrix.industry_id == industry.id) + .order_by(Persona.id) + .all() + ) + + if not entries: + print(f"No marketing texts found for industry: {industry_name}") + return + + print(f"--- NEW TEXTS FOR {industry_name} ---") + for entry in entries: + print(f"\nPERSONA: {entry.persona.name}") + print(f"Subject: {entry.subject}") + print(f"Intro: {entry.intro.replace(chr(10), ' ')}") # Replace newlines for cleaner one-line output + + except Exception as e: + print(f"An error occurred: {e}") + finally: + db.close() + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Debug and check marketing matrix texts for a given industry.") + parser.add_argument( + "industry", + type=str, + nargs='?', + default="Healthcare - Hospital", + help="The name of the industry to check (e.g., 'Healthcare - Hospital'). Defaults to 'Healthcare - Hospital'." + ) + args = parser.parse_args() + + check_texts_for_industry(args.industry) diff --git a/company-explorer/backend/scripts/generate_matrix.py b/company-explorer/backend/scripts/generate_matrix.py index 0a030a19..b0d562f4 100644 --- a/company-explorer/backend/scripts/generate_matrix.py +++ b/company-explorer/backend/scripts/generate_matrix.py @@ -112,9 +112,10 @@ PERSÖNLICHE HERAUSFORDERUNGEN DES ANSPRECHPARTNERS (PAIN POINTS): --- DEINE AUFGABE --- 1. **Subject:** Formuliere eine kurze Betreffzeile (max. 6 Wörter). Richte sie **direkt an einem der persönlichen Pain Points** des Ansprechpartners oder dem zentralen Branchen-Pain. Sei scharfsinnig, nicht werblich. -2. **Introduction_Textonly:** Formuliere einen Einleitungstext (2-3 Sätze). - - **Satz 1 (Die Brücke):** Knüpfe an die (uns unbekannte) operative Herausforderung an. Beschreibe subtil den Nutzen einer Lösung, ohne das Produkt (Roboter) plump zu nennen. - - **Satz 2 (Die Relevanz):** Schaffe die Relevanz für die Zielperson, indem du das Thema mit einem ihrer persönlichen Pain Points verknüpfst (z.B. "Für Sie als {persona.name} ist dabei entscheidend..."). +2. **Introduction_Textonly:** Formuliere einen prägnanten Einleitungstext (max. 2 Sätze). + - **WICHTIG:** Gehe davon aus, dass die spezifische Herausforderung des Kunden bereits im Satz davor [Opener] genannt wurde. **Wiederhole die Herausforderung NICHT.** + - **Satz 1 (Die Lösung & der Gain):** Beginne direkt mit der Lösung. Nenne die im Kontext `FOKUS-PRODUKT` definierte **Produktkategorie** (z.B. "automatisierte Reinigungsroboter") und verbinde sie mit dem zentralen Nutzen (Gain) aus den `BRANCHEN-HERAUSFORDERUNGEN`. Beispiel: "Genau hier setzen unsere automatisierten Reinigungsroboter an, indem sie eine lückenlose und auditsichere Hygiene gewährleisten." + - **Satz 2 (Die Relevanz):** Stelle die Relevanz für die Zielperson her, indem du einen ihrer `PERSÖNLICHE HERAUSFORDERUNGEN` adressierst. Beispiel: "Für Sie als Infrastruktur-Verantwortlicher bedeutet dies vor allem eine reibungslose Integration in bestehende Abläufe, ohne den Betrieb zu stören." 3. **Industry_References_Textonly:** Formuliere einen **strategischen Referenz-Block (ca. 2-3 Sätze)** nach folgendem Muster: - **Satz 1 (Social Proof):** Beginne direkt mit dem Nutzen, den vergleichbare Unternehmen in der Branche {industry.name} bereits erzielen. (Erfinde keine Firmennamen, sprich von "Führenden Einrichtungen" oder "Vergleichbaren Häusern"). diff --git a/list_industries.py b/list_industries.py new file mode 100644 index 00000000..bf7c5338 --- /dev/null +++ b/list_industries.py @@ -0,0 +1,18 @@ + +import sys +import os +sys.path.append(os.path.join(os.path.dirname(__file__), "company-explorer")) +from backend.database import SessionLocal, Industry + +def list_industries(): + db = SessionLocal() + try: + industries = db.query(Industry.name).all() + print("Available Industries:") + for (name,) in industries: + print(f"- {name}") + finally: + db.close() + +if __name__ == "__main__": + list_industries() diff --git a/read_matrix_entry.py b/read_matrix_entry.py new file mode 100644 index 00000000..28a62303 --- /dev/null +++ b/read_matrix_entry.py @@ -0,0 +1,37 @@ + +import sys +import os +sys.path.append(os.path.join(os.path.dirname(__file__), "company-explorer")) +from backend.database import SessionLocal, Industry, Persona, MarketingMatrix + +def read_specific_entry(industry_name: str, persona_name: str): + db = SessionLocal() + try: + entry = ( + db.query(MarketingMatrix) + .join(Industry) + .join(Persona) + .filter(Industry.name == industry_name, Persona.name == persona_name) + .first() + ) + + if not entry: + print(f"No entry found for {industry_name} and {persona_name}") + return + + print("--- Generated Text ---") + print(f"Industry: {industry_name}") + print(f"Persona: {persona_name}") + print("\n[Intro]") + print(entry.intro) + print("\n[Social Proof]") + print(entry.social_proof) + print("----------------------") + + finally: + db.close() + +if __name__ == "__main__": + read_specific_entry("Healthcare - Hospital", "Infrastruktur-Verantwortlicher") + +