DrishtiSharma commited on
Commit
3e68723
·
verified ·
1 Parent(s): 7e42dc2

Update graph.py

Browse files
Files changed (1) hide show
  1. graph.py +16 -4
graph.py CHANGED
@@ -150,10 +150,10 @@ class EssayWriter:
150
  import os
151
  import graphviz
152
 
153
- def save_workflow_graph(self):
154
- """Generate and save a Graphviz workflow visualization with logging."""
155
- log_file = "/tmp/graph_debug.log"
156
- try:
157
  output_path = "/tmp/graph"
158
  dot = graphviz.Digraph(format="png")
159
  dot.attr(dpi='300')
@@ -194,4 +194,16 @@ class EssayWriter:
194
 
195
 
196
 
 
 
 
 
 
 
 
 
 
 
 
 
197
 
 
150
  import os
151
  import graphviz
152
 
153
+ #def save_workflow_graph(self):
154
+ # """Generate and save a Graphviz workflow visualization with logging."""
155
+ # log_file = "/tmp/graph_debug.log"
156
+ # try:
157
  output_path = "/tmp/graph"
158
  dot = graphviz.Digraph(format="png")
159
  dot.attr(dpi='300')
 
194
 
195
 
196
 
197
+ def save_workflow_graph(self):
198
+ """Generate and save a dynamic LangGraph visualization."""
199
+ try:
200
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmpfile:
201
+ with open(tmpfile.name, "wb") as f:
202
+ f.write(self.graph.get_graph().draw_mermaid_png())
203
+
204
+ print(f"✅ Workflow visualization updated: {tmpfile.name}")
205
+ except Exception as e:
206
+ print(f"❌ Error generating graph: {e}")
207
+
208
+
209