Isaac Quarenta commited on
Commit
2ca844a
·
1 Parent(s): 4a6a9a9

fix: brand_identity returns media_response format for agent loop + SQL error shows query params

Browse files
modules/cellcog_integration.py CHANGED
@@ -604,14 +604,21 @@ class CellCogClient:
604
  except:
605
  pass
606
 
 
 
 
 
 
 
 
 
 
 
607
  return {
608
  "success": True,
609
  "brand_name": brand_name,
610
- "logo_buffer": logo_buffer,
611
  "colors": result.get("color_palette", []),
612
- "typography": result.get("typography", {}),
613
  "guidelines": result.get("guidelines", ""),
614
- "style": result.get("style", ""),
615
  "model": "cellcog"
616
  }
617
  else:
@@ -626,16 +633,15 @@ class CellCogClient:
626
  prompt=f"Professional logo for '{brand_name}', {description}, {industry} industry, clean design, minimalist",
627
  model="photo"
628
  )
629
- if hf_result.get("success"):
630
  return {
631
- "success": True,
632
- "brand_name": brand_name,
633
- "logo_buffer": hf_result.get("image_buffer"),
634
- "colors": [],
635
- "typography": {},
636
- "guidelines": f"Logo gerado via HuggingFace para {brand_name}",
637
- "style": "photo",
638
- "model": "hf_fallback"
639
  }
640
 
641
  return {"success": False, "error": "CellCog e HF indisponíveis para branding"}
 
604
  except:
605
  pass
606
 
607
+ if logo_buffer:
608
+ return {
609
+ "type": "media_response",
610
+ "media_response": {
611
+ "tipo": "imagem",
612
+ "buffer": logo_buffer,
613
+ "caption": f"Logo '{brand_name}' — {description}",
614
+ "model": "cellcog"
615
+ }
616
+ }
617
  return {
618
  "success": True,
619
  "brand_name": brand_name,
 
620
  "colors": result.get("color_palette", []),
 
621
  "guidelines": result.get("guidelines", ""),
 
622
  "model": "cellcog"
623
  }
624
  else:
 
633
  prompt=f"Professional logo for '{brand_name}', {description}, {industry} industry, clean design, minimalist",
634
  model="photo"
635
  )
636
+ if hf_result.get("success") and hf_result.get("image_buffer"):
637
  return {
638
+ "type": "media_response",
639
+ "media_response": {
640
+ "tipo": "imagem",
641
+ "buffer": hf_result.get("image_buffer"),
642
+ "caption": f"Logo '{brand_name}' — {description}",
643
+ "model": "hf_fallback"
644
+ }
 
645
  }
646
 
647
  return {"success": False, "error": "CellCog e HF indisponíveis para branding"}
modules/database_pg.py CHANGED
@@ -213,7 +213,7 @@ class DatabasePG:
213
  except Exception as e:
214
  if conn:
215
  conn.rollback()
216
- logger.error(f"Erro SQL PG: {e}")
217
  raise
218
  finally:
219
  if conn:
 
213
  except Exception as e:
214
  if conn:
215
  conn.rollback()
216
+ logger.error(f"Erro SQL PG: {e} | query={pg_query[:100]} | params={params}")
217
  raise
218
  finally:
219
  if conn: