feat(gtm): add responsive collapsible sidebar for mobile
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import json
|
||||
@@ -202,9 +203,7 @@ def phase1(payload):
|
||||
|
||||
try:
|
||||
data = json.loads(response)
|
||||
|
||||
# FIX: Save raw dictionary, not stringified JSON, to avoid double encoding
|
||||
db_manager.save_gtm_result(project_id, 'phase1_result', data)
|
||||
db_manager.save_gtm_result(project_id, 'phase1_result', json.dumps(data))
|
||||
|
||||
# WICHTIG: ID zurückgeben, damit Frontend sie speichert
|
||||
data['projectId'] = project_id
|
||||
@@ -214,7 +213,7 @@ def phase1(payload):
|
||||
error_response = {
|
||||
"error": "Die Antwort des KI-Modells war kein gültiges JSON. Das passiert manchmal bei hoher Auslastung. Bitte versuchen Sie es in Kürze erneut.",
|
||||
"details": response,
|
||||
"projectId": project_id
|
||||
"projectId": project_id # Auch bei Fehler ID zurückgeben? Besser nicht, da noch nichts gespeichert.
|
||||
}
|
||||
return error_response
|
||||
|
||||
@@ -240,9 +239,7 @@ def phase2(payload):
|
||||
response = call_gemini_flash(prompt, system_instruction=sys_instr, json_mode=True)
|
||||
log_and_save(project_id, "phase2", "response", response)
|
||||
data = json.loads(response)
|
||||
|
||||
# FIX: Save raw dictionary
|
||||
db_manager.save_gtm_result(project_id, 'phase2_result', data)
|
||||
db_manager.save_gtm_result(project_id, 'phase2_result', json.dumps(data))
|
||||
return data
|
||||
|
||||
def phase3(payload):
|
||||
@@ -266,9 +263,7 @@ def phase3(payload):
|
||||
response = call_gemini_flash(prompt, system_instruction=sys_instr, json_mode=True)
|
||||
log_and_save(project_id, "phase3", "response", response)
|
||||
data = json.loads(response)
|
||||
|
||||
# FIX: Save raw dictionary
|
||||
db_manager.save_gtm_result(project_id, 'phase3_result', data)
|
||||
db_manager.save_gtm_result(project_id, 'phase3_result', json.dumps(data))
|
||||
return data
|
||||
|
||||
def phase4(payload):
|
||||
@@ -299,9 +294,7 @@ def phase4(payload):
|
||||
response = call_gemini_flash(prompt, system_instruction=sys_instr, json_mode=True)
|
||||
log_and_save(project_id, "phase4", "response", response)
|
||||
data = json.loads(response)
|
||||
|
||||
# FIX: Save raw dictionary
|
||||
db_manager.save_gtm_result(project_id, 'phase4_result', data)
|
||||
db_manager.save_gtm_result(project_id, 'phase4_result', json.dumps(data))
|
||||
return data
|
||||
|
||||
def phase5(payload):
|
||||
@@ -372,9 +365,7 @@ def phase5(payload):
|
||||
report = report.strip()
|
||||
|
||||
log_and_save(project_id, "phase5", "response", report)
|
||||
|
||||
# FIX: Save raw dictionary (no double JSON stringification)
|
||||
db_manager.save_gtm_result(project_id, 'phase5_result', {"report": report})
|
||||
db_manager.save_gtm_result(project_id, 'phase5_result', json.dumps({"report": report}))
|
||||
return {"report": report}
|
||||
|
||||
def phase6(payload):
|
||||
@@ -400,9 +391,7 @@ def phase6(payload):
|
||||
response = call_gemini_flash(prompt, system_instruction=sys_instr, json_mode=True)
|
||||
log_and_save(project_id, "phase6", "response", response)
|
||||
data = json.loads(response)
|
||||
|
||||
# FIX: Save raw dictionary
|
||||
db_manager.save_gtm_result(project_id, 'phase6_result', data)
|
||||
db_manager.save_gtm_result(project_id, 'phase6_result', json.dumps(data))
|
||||
return data
|
||||
|
||||
def phase7(payload):
|
||||
@@ -428,9 +417,7 @@ def phase7(payload):
|
||||
response = call_gemini_flash(prompt, system_instruction=sys_instr, json_mode=True)
|
||||
log_and_save(project_id, "phase7", "response", response)
|
||||
data = json.loads(response)
|
||||
|
||||
# FIX: Save raw dictionary
|
||||
db_manager.save_gtm_result(project_id, 'phase7_result', data)
|
||||
db_manager.save_gtm_result(project_id, 'phase7_result', json.dumps(data))
|
||||
return data
|
||||
|
||||
def phase8(payload):
|
||||
@@ -455,9 +442,7 @@ def phase8(payload):
|
||||
response = call_gemini_flash(prompt, system_instruction=sys_instr, json_mode=True)
|
||||
log_and_save(project_id, "phase8", "response", response)
|
||||
data = json.loads(response)
|
||||
|
||||
# FIX: Save raw dictionary
|
||||
db_manager.save_gtm_result(project_id, 'phase8_result', data)
|
||||
db_manager.save_gtm_result(project_id, 'phase8_result', json.dumps(data))
|
||||
return data
|
||||
|
||||
def phase9(payload):
|
||||
@@ -483,9 +468,7 @@ def phase9(payload):
|
||||
response = call_gemini_flash(prompt, system_instruction=sys_instr, json_mode=True)
|
||||
log_and_save(project_id, "phase9", "response", response)
|
||||
data = json.loads(response)
|
||||
|
||||
# FIX: Save raw dictionary
|
||||
db_manager.save_gtm_result(project_id, 'phase9_result', data)
|
||||
db_manager.save_gtm_result(project_id, 'phase9_result', json.dumps(data))
|
||||
return data
|
||||
|
||||
def translate(payload):
|
||||
@@ -588,4 +571,4 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user