lastmile-ai / aiconfig

AIConfig is a config-based framework to build generative AI applications.
https://aiconfig.lastmileai.dev
MIT License
964 stars 79 forks source link

[editor] Ctrl+Z does not return the prompts - input however returns the outputs - data #1457

Open vanshb03 opened 8 months ago

vanshb03 commented 8 months ago

Proposed Solution:

When the user presses Ctrl+Z, the editor should undo the last action, including both the input and output, to restore the previous state compared to solely the output as it is right now. This behavior would be consistent with the interface, where Ctrl+Z typically undoes the last text entry or command. By restoring the input as well, users can easily revert to a previous state for their prompt input.

Expected Behavior:

Current Behavior:

LASTMILE #1457

vanshb03 commented 8 months ago

Suggested Labels:

saqadri commented 8 months ago

@vanshb03 thanks a lot for reporting, and for your suggestion. @rholinshead what do you think about this? We are currently doing undo/redo just based on the state that is propagated to the TextDocument

rholinshead commented 8 months ago

Hmm, @vanshb03 may I ask which version of the extension you are using? Undo/redo was added a little while ago and should include undo/redo on the prompt inputs. Here's what I experience, for reference (on lastest extension version v0.0.21):

https://github.com/lastmile-ai/aiconfig/assets/5060851/5d6b22bd-57b0-4cab-adc8-a4558f920772

If we can rule out the version as a potential cause of the issue, we can debug further to see what might be happening on your end to not have it working as expected.

vanshb03 commented 8 months ago

So to recreate the issue, you have to click in the box before you Ctrl+Z, that is when the output box is the only one that changes and the input box remains the same as shown on the issue.

@rholinshead @saqadri

rholinshead commented 8 months ago

With clicking the input box I'm still able to get the input to be undone

https://github.com/lastmile-ai/aiconfig/assets/5060851/431af779-e973-420d-ab49-7abb31fe3cf0

But, maybe I misunderstood the expected behaviour? For context, the series of events that happens when updating the input and running is: (update input) -> (run, clear existing input) -> (run, update output). When I Ctrl+Z I can see these events being undone in reverse.

In your experience, is that not the case? Or are you instead proposing that Ctrl+Z in this case should undo the three events together as one step?

If the latter, there is a complication with doing so. It's possible that there could be some other unrelated event between (update input) and (run) for that input (e.g. adding another cell), or it's possible that there are a series of (update input) events before running -- this is actually the case, as you type with short pauses -- which would then need some heuristic to understand how many updates to undo.

Or, alternatively if you are proposing that Ctrl+Z should only undo the input and NOT the output, then that does resonate, since that's the behaviour in colab/jupyter for notebooks. If this is the case, the good news is I believe this will naturally happen as a result of some future updates to aiconfig.

vanshb03 commented 7 months ago

Yes, I was proposing that Ctrl+Z would only undo the input and not the output solely as it is currently.

Suggested Labels:

status: planned sdk