Update: GTM Architect v2.6.2 (Edit Specs, Report Fix) & Company Explorer v0.4 (Export, Timestamps)
This commit is contained in:
@@ -211,6 +211,7 @@ def phase1(payload):
|
||||
"product_id": "string (slug)",
|
||||
"brand": "string",
|
||||
"model_name": "string",
|
||||
"description": "string (short marketing description of the product)",
|
||||
"category": "cleaning | service | security | industrial",
|
||||
"manufacturer_url": "string"
|
||||
},
|
||||
@@ -289,6 +290,16 @@ def phase1(payload):
|
||||
specs_data['metadata'] = {}
|
||||
specs_data['metadata']['manufacturer_url'] = product_input.strip()
|
||||
|
||||
# AUTO-RENAME PROJECT based on extracted metadata
|
||||
if 'metadata' in specs_data:
|
||||
brand = specs_data['metadata'].get('brand', '')
|
||||
model = specs_data['metadata'].get('model_name', '')
|
||||
if brand or model:
|
||||
new_name = f"{brand} {model}".strip()
|
||||
if new_name:
|
||||
logging.info(f"Renaming project {project_id} to: {new_name}")
|
||||
db_manager.update_project_name(project_id, new_name)
|
||||
|
||||
data['specs'] = specs_data
|
||||
except json.JSONDecodeError:
|
||||
logging.error(f"Failed to decode JSON from Gemini response in phase1 (specs): {specs_response}")
|
||||
@@ -404,9 +415,11 @@ def phase5(payload):
|
||||
lang_instr = get_output_lang_instruction(lang)
|
||||
|
||||
# Reduziere Input-Daten auf das Wesentliche, um den Output-Fokus zu verbessern
|
||||
# FIX: Include 'specs' (Hard Facts) for the report
|
||||
lean_phase1 = {
|
||||
"features": phase1_data.get('features', []),
|
||||
"constraints": phase1_data.get('constraints', [])
|
||||
"constraints": phase1_data.get('constraints', []),
|
||||
"specs": phase1_data.get('specs', {})
|
||||
}
|
||||
|
||||
prompt = f"""
|
||||
@@ -415,6 +428,7 @@ def phase5(payload):
|
||||
INPUT DATA:
|
||||
- Product: {json.dumps(lean_phase1)}
|
||||
- ICPs: {json.dumps(phase2_data.get('icps', []))}
|
||||
- Data Proxies: {json.dumps(phase2_data.get('dataProxies', []))}
|
||||
- Targets: {json.dumps(phase3_data.get('whales', []))}
|
||||
- Strategy Matrix: {json.dumps(phase4_data.get('strategyMatrix', []))}
|
||||
|
||||
@@ -424,9 +438,14 @@ def phase5(payload):
|
||||
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**:
|
||||
3. **Technical Specifications (Hard Facts)**:
|
||||
- Create a dedicated section displaying the technical data (Dimensions, Weight, Runtime, Layers, etc.) found in 'Product.specs'.
|
||||
- Use a clear Markdown table or bullet points.
|
||||
4. **Phase 2: ICP Discovery**:
|
||||
- Present the selected ICPs (Industries) and the rationale behind them.
|
||||
- List the identified Data Proxies used to find these customers.
|
||||
5. **Target Accounts**: Top companies (Whales).
|
||||
6. **Strategy Matrix**:
|
||||
- Create a STRICT Markdown table.
|
||||
- Columns: Segment | Pain Point | Angle | Differentiation
|
||||
- Template:
|
||||
@@ -435,8 +454,8 @@ def phase5(payload):
|
||||
| [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.
|
||||
7. **Next Steps**: Actionable recommendations.
|
||||
8. **Hybrid Service Logic**: Explain the machine/human symbiosis.
|
||||
|
||||
{lang_instr}
|
||||
|
||||
@@ -561,6 +580,47 @@ def phase9(payload):
|
||||
data = json.loads(response)
|
||||
db_manager.save_gtm_result(project_id, 'phase9_result', json.dumps(data))
|
||||
return data
|
||||
|
||||
def update_specs(payload):
|
||||
"""
|
||||
Updates the technical specifications (Hard Facts) for a project.
|
||||
This allows manual correction of AI-extracted data.
|
||||
"""
|
||||
project_id = payload.get('projectId')
|
||||
new_specs = payload.get('specs')
|
||||
|
||||
if not project_id:
|
||||
raise ValueError("No projectId provided for update_specs.")
|
||||
if not new_specs:
|
||||
raise ValueError("No specs provided for update_specs.")
|
||||
|
||||
# Load current project data
|
||||
project_data = db_manager.get_project_data(project_id)
|
||||
if not project_data:
|
||||
raise ValueError(f"Project {project_id} not found.")
|
||||
|
||||
phases = project_data.get('phases', {})
|
||||
phase1_result = phases.get('phase1_result')
|
||||
|
||||
if not phase1_result:
|
||||
raise ValueError("Phase 1 result not found. Cannot update specs.")
|
||||
|
||||
# FIX: Parse JSON string if necessary
|
||||
if isinstance(phase1_result, str):
|
||||
try:
|
||||
phase1_result = json.loads(phase1_result)
|
||||
except json.JSONDecodeError:
|
||||
raise ValueError("Phase 1 result is corrupted (invalid JSON string).")
|
||||
|
||||
# Update specs
|
||||
phase1_result['specs'] = new_specs
|
||||
|
||||
# Save back to DB
|
||||
# We use save_gtm_result which expects a stringified JSON for the phase result
|
||||
db_manager.save_gtm_result(project_id, 'phase1_result', json.dumps(phase1_result))
|
||||
|
||||
logging.info(f"Updated specs for project {project_id}")
|
||||
return {"status": "success", "specs": new_specs}
|
||||
|
||||
def translate(payload):
|
||||
# ... (to be implemented)
|
||||
@@ -633,6 +693,7 @@ def main():
|
||||
"phase7": phase7,
|
||||
"phase8": phase8,
|
||||
"phase9": phase9,
|
||||
"update_specs": update_specs,
|
||||
"translate": translate,
|
||||
"image": image,
|
||||
"list_history": list_history,
|
||||
|
||||
Reference in New Issue
Block a user