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

Add /fix slash command #828

Merged
merged 8 commits into from
Jun 12, 2024
Merged

Add /fix slash command #828

merged 8 commits into from
Jun 12, 2024

Conversation

dlqqq
Copy link
Member

@dlqqq dlqqq commented Jun 11, 2024

This PR introduces a new /fix slash command that fixes a code cell with error output when selected in an open notebook.

  • /fix only works when a code cell with error output is the active cell. Otherwise the UI prevents /fix from being sent.
  • /fix also accepts additional instructions in natural language following /fix.
    For example: /fix Fix this code cell by using the numpy library only.
  • The code action toolbar can used to quickly replace the active cell with the revised code suggested by Jupyternaut.

Demo video

Screen.Recording.2024-06-11.at.10.49.17.AM.mov

@dlqqq dlqqq added the enhancement New feature or request label Jun 11, 2024
@dlqqq dlqqq mentioned this pull request Jun 11, 2024
2 tasks
Copy link
Collaborator

@srdas srdas left a comment

Choose a reason for hiding this comment

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

Thanks for adding this, it is very useful, and should really help developers a lot.

[1] Tested the branch and it works well and nothing else seems to be broken.

[2] Tested that the /fix command works in an active cell that has an error whether you click on the code or the output.

[3] Tested that when the cell does not have an error, then /fix cannot be used.

[4] Tested that when the cell has only a warning, then /fix cannot be used. Do we want to have /fix work for cells with warnings?

[5] Nit: "Insert below active cell" (see below) does not say if the code will be inserted in the cell below (overwriting it) or insert a new cell and add the new code to it. The action is the latter but may be we want to point it out. (This is not directly related to this PR.)
image

[6] I am getting a new chat user as shown below, is this intended?
image

@dlqqq
Copy link
Member Author

dlqqq commented Jun 12, 2024

@srdas Thank you for the quick review! I've addressed your review feedback in the threads above.

[6] I am getting a new chat user as shown below, is this intended?

This is likely because you have jupyter-collaboration installed in your environment. When this is the case, Jupyter AI automatically infers your identity from the RTC identity provider. When RTC is enabled, the name shown in the chat panel matches the name shown in the collaborators panel.

Copy link
Collaborator

@srdas srdas left a comment

Choose a reason for hiding this comment

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

Awesome work!! Verified all suggestions are implemented! TY!

@dlqqq dlqqq merged commit 289d39d into jupyterlab:main Jun 12, 2024
8 checks passed
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* remove unused clear_memory() method in default.py

* implement error output signaling and retrieval in ActiveCellContext

* fixup

* implement /fix slash command

* pre-commit

* add docstring

* edit reply message when no active cell with error output exists

* add user documentation and screenshots for /fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants