Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redo undo printing #372

Merged
merged 7 commits into from
Dec 11, 2023
Merged

Redo undo printing #372

merged 7 commits into from
Dec 11, 2023

Conversation

PCSwingle
Copy link
Member

Fixes #356.

Copy link
Member

@biobootloader biobootloader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍

@biobootloader
Copy link
Member

actually should we display the inverse of the changes? I'm not sure what would be clearer...

@biobootloader
Copy link
Member

Like here the undo changes would be red - lines: image

@PCSwingle
Copy link
Member Author

I think it makes sense the way it currently is, but I definitely see both sides.

@granawkins
Copy link
Member

I too think red makes sense. Maybe a simple 'inverse' arg somewhere could make this simple.

@biobootloader
Copy link
Member

Maybe we could keep the edit the same but surround it with something to make it more clear it's being undone? Or indent the whole block with some prefix for all the lines to show it's an undo?

@PCSwingle
Copy link
Member Author

Maybe we could keep the edit the same but surround it with something to make it more clear it's being undone? Or indent the whole block with some prefix for all the lines to show it's an undo?

I prefer this approach a lot; what are your thoughts for how we would make it clearer though?

@biobootloader
Copy link
Member

Thoughts?

>>> add exp
Total token count: 1448
Streaming... use control-c to interrupt the model at any point

I will add a new function to handle exponentiation and update the calculate function to include this new operation.
Steps:
1. Add a new function `exponentiate_numbers` to perform exponentiation.
2. Update the `calculate` function to handle the "exponentiate" operation.

testbed/scripts/calculator.py
============================================================
15:
16:def divide_numbers(a, b):
+  def exponentiate_numbers(a, b):
+      return a ** b
17:    return a / b
18:
============================================================
29:    elif operation == "divide":
30:        result = divide_numbers(num1, num2)
+      elif operation == "exponentiate":
+          result = exponentiate_numbers(num1, num2)
31:    else:
32:        print("Invalid operation")
============================================================
Speed: 22.01 tkns/s | Cost: $0.02
Apply these changes? 'Y/n/i' or provide feedback.
>>>
Changes applied.

What can I do for you?
>>> /undo

UNDO: testbed/scripts/calculator.py
UNDO: ============================================================
UNDO: 29:    elif operation == "divide":
UNDO: 30:        result = divide_numbers(num1, num2)
UNDO: +      elif operation == "exponentiate":
UNDO: +          result = exponentiate_numbers(num1, num2)
UNDO: 31:    else:
UNDO: 32:        print("Invalid operation")
UNDO: ============================================================

UNDO: testbed/scripts/calculator.py
UNDO: ============================================================
UNDO: 15:
UNDO: 16:def divide_numbers(a, b):
UNDO: +  def exponentiate_numbers(a, b):
UNDO: +      return a ** b
UNDO: 17:    return a / b
UNDO: 18:
UNDO: ============================================================
Edits to file /Users/biobootloader/code/mentat/testbed/scripts/calculator.py undone
Undo complete

@PCSwingle
Copy link
Member Author

Oh, I like this a lot! I'll get this done and then merge.

@PCSwingle PCSwingle merged commit c39de8f into main Dec 11, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/undo /redo print changes
3 participants