socketteer / loom

Multiversal tree writing interface for human-AI collaboration
1.02k stars 75 forks source link

Deleting nodes break Loom #2

Closed njbbaer closed 2 years ago

njbbaer commented 2 years ago

Attempting to delete any node fails and breaks the Loom UI. I can still click around, but the text window does not update.

Note: this is my first time using Loom.

This is the console output when a node is attempted to be deleted:

loom$ python main.py
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
opening /home/nate/loom/data/GPT_chat.json
saving tree
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.8/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "/home/nate/loom/controller.py", line 52, in <lambda>
    return lambda event=None, *args, _f=f, **kwargs: _f(*args, **kwargs)
  File "/home/nate/loom/util/util.py", line 355, in f
    return func(*args, **kwargs)
  File "/home/nate/loom/controller.py", line 684, in delete_node
    self.select_node(next_sibling)
  File "/home/nate/loom/util/util.py", line 355, in f
    return func(*args, **kwargs)
  File "/home/nate/loom/controller.py", line 430, in select_node
    self.write_textbox_changes()
  File "/home/nate/loom/util/util.py", line 355, in f
    return func(*args, **kwargs)
  File "/home/nate/loom/controller.py", line 910, in write_textbox_changes
    if self.state.preferences['editable']:
  File "/home/nate/loom/model.py", line 257, in preferences
    return self.state['preferences']
  File "/home/nate/loom/model.py", line 313, in state
    frames = self.accumulate_frames(self.selected_node)
  File "/home/nate/loom/model.py", line 334, in accumulate_frames
    for ancestor in self.ancestry(node):
  File "/home/nate/loom/model.py", line 540, in ancestry
    return node_ancestry(node, self.tree_node_dict)
  File "/home/nate/loom/util/util_tree.py", line 152, in node_ancestry
    while "parent_id" in node:
TypeError: argument of type 'NoneType' is not iterable
socketteer commented 2 years ago

Thanks a lot for letting me know. This is due to some changes I've made recently. I've pushed a commit that fixes this bug.

socketteer commented 2 years ago

Hey! That commit actually broke something else, but I've pushed another one that fixes that problem. Make sure to pull the latest version.