Update concept_map_generator.py
Browse files- concept_map_generator.py +3 -7
concept_map_generator.py
CHANGED
|
@@ -217,13 +217,9 @@ def generate_concept_map(json_input: str, output_format: str) -> str:
|
|
| 217 |
# Add child nodes and edges recursively starting from depth 1
|
| 218 |
add_nodes_and_edges(dot, 'central', data.get('nodes', []), current_depth=1, base_color=base_color)
|
| 219 |
|
| 220 |
-
with NamedTemporaryFile(delete=False) as
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
final_output_path = f"{temp_base_path}.{output_format}" # La ruta real que Graphviz creará
|
| 224 |
-
|
| 225 |
-
# dot.render() crea el archivo con la extensión correcta. cleanup=True elimina el archivo base (tmp_base_path).
|
| 226 |
-
dot.render(temp_base_path, format=output_format, cleanup=True)
|
| 227 |
|
| 228 |
except json.JSONDecodeError:
|
| 229 |
return "Error: Invalid JSON format"
|
|
|
|
| 217 |
# Add child nodes and edges recursively starting from depth 1
|
| 218 |
add_nodes_and_edges(dot, 'central', data.get('nodes', []), current_depth=1, base_color=base_color)
|
| 219 |
|
| 220 |
+
with NamedTemporaryFile(delete=False, suffix=f'.{output_format}') as tmp:
|
| 221 |
+
dot.render(tmp.name, format=output_format, cleanup=True)
|
| 222 |
+
return f"{tmp.name}.{output_format}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
|
| 224 |
except json.JSONDecodeError:
|
| 225 |
return "Error: Invalid JSON format"
|