feat(gtm): improve phase 5 report rendering & update documentation to v2.3

This commit is contained in:
2026-01-04 18:29:30 +00:00
parent d43012eeb5
commit 07f4ffb225
19 changed files with 664 additions and 41 deletions

View File

@@ -305,21 +305,47 @@ def phase5(payload):
lang = payload.get('lang', 'de')
project_id = payload.get('projectId')
# Logging zur Diagnose
strat_matrix = phase4_data.get('strategyMatrix', [])
logging.info(f"Phase 5 Input Check - Strategy Matrix Rows: {len(strat_matrix)}")
sys_instr = get_system_instruction(lang)
lang_instr = get_output_lang_instruction(lang)
# Reduziere Input-Daten auf das Wesentliche, um den Output-Fokus zu verbessern
lean_phase1 = {
"features": phase1_data.get('features', []),
"constraints": phase1_data.get('constraints', [])
}
prompt = f"""
PHASE 5: ASSET GENERATION & FINAL REPORT
CONTEXT DATA:
- Technical: {json.dumps(phase1_data)}
- ICPs: {json.dumps(phase2_data)}
- Targets (Whales): {json.dumps(phase3_data)}
- Strategy: {json.dumps(phase4_data)}
PHASE 5: FINAL REPORT GENERATION
INPUT DATA:
- Product: {json.dumps(lean_phase1)}
- ICPs: {json.dumps(phase2_data.get('icps', []))}
- Targets: {json.dumps(phase3_data.get('whales', []))}
- Strategy Matrix: {json.dumps(phase4_data.get('strategyMatrix', []))}
TASK:
1. Create a "GTM STRATEGY REPORT" in Markdown.
2. CONSOLIDATE ALL PREVIOUS PHASES (1-4) into the report. Don't skip details.
3. Report Structure: Executive Summary, Product Analysis, Target Audience (ICPs), Target Accounts (Whales), Strategy Matrix, Next Steps.
4. Hybrid-Check: Ensure "Hybrid Service Logic" is visible.
Write a professional "GTM STRATEGY REPORT" in Markdown.
REQUIRED STRUCTURE:
1. **Executive Summary**: A brief strategic overview.
2. **Product Analysis**: Key features & constraints.
3. **Target Audience**: The selected ICPs and why.
4. **Target Accounts**: Top companies (Whales).
5. **Strategy Matrix**:
- Create a STRICT Markdown table.
- Columns: Segment | Pain Point | Angle | Differentiation
- Template:
| Segment | Pain Point | Angle | Differentiation |
| :--- | :--- | :--- | :--- |
| [Content] | [Content] | [Content] | [Content] |
- Use the data from the 'Strategy Matrix' input.
- Do NOT use newlines inside table cells (use <br> instead) to keep the table structure intact.
6. **Next Steps**: Actionable recommendations.
7. **Hybrid Service Logic**: Explain the machine/human symbiosis.
{lang_instr}
@@ -327,6 +353,17 @@ def phase5(payload):
"""
log_and_save(project_id, "phase5", "prompt", prompt)
report = call_gemini_flash(prompt, system_instruction=sys_instr, json_mode=False)
# Clean up potentially fenced markdown code blocks
report = report.strip()
if report.startswith("```markdown"):
report = report.replace("```markdown", "", 1)
if report.startswith("```"):
report = report.replace("```", "", 1)
if report.endswith("```"):
report = report[:-3]
report = report.strip()
log_and_save(project_id, "phase5", "response", report)
db_manager.save_gtm_result(project_id, 'phase5_result', json.dumps({"report": report}))
return {"report": report}