griptape-ai/griptape

StructureVisualizer(workflow).to_url() returning "invalid encoded code"

Closed this issue · 1 comments

Describe the bug
When I try and use the new StructureVisualizer, it returns an invalid url.

To Reproduce
If I run this, and then go to the url I get invalid encoded code

from griptape.structures import Workflow
from griptape.tasks import PromptTask
from griptape.utils import StructureVisualizer

start_task = PromptTask("This is the start", id="start")
child1 = PromptTask("This is the first child", id="child1")
child2 = PromptTask("This is the second child", id="child2")
child3 = PromptTask("This is the third child", id="child3")
end_task = PromptTask("This is the end", id="end")

# workflow.add_task(start_task)

child1.add_parent(start_task)
child2.add_parent(child1)
child2.add_child(end_task)
child3.add_parent(child1)
child3.add_child(end_task)

workflow = Workflow(tasks=[start_task, child1, child2, child3, end_task])

result = StructureVisualizer(workflow).to_url()
print(result)

looks like the literal string end is a protected word in mermaid-speak. try changing it to something else and see if it still errors out. I changed it to final and it seems like it works