jupyter-ai icon indicating copy to clipboard operation
jupyter-ai copied to clipboard

Support Notebook 7

Open jtpio opened this issue 1 year ago • 5 comments
trafficstars

Looking at the code, there seems to be some components that expect to work on a LabShell only:

https://github.com/jupyterlab/jupyter-ai/blob/9c69a7b851d46a66bb9664b4b906bdd7e55e984e/packages/jupyter-ai/src/selection-watcher.ts#L102

Which can prevent using the extension in other lab-based applications such as Notebook 7.

Maybe there can be a way to make jupyter-ai work in more lab-based applications? Even if only a limited set of features is available.

For instance this could allow for code completions in Notebook 7.1 (based on https://github.com/jupyterlab/jupyter-ai/pull/465). Below is an example running https://github.com/krassowski/jupyterlab-transformers-completer:

https://github.com/jupyter/notebook/assets/591645/4e0bdd08-fec9-4e54-9dcf-42119688632c

jtpio avatar Dec 05 '23 10:12 jtpio

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Dec 05 '23 10:12 welcome[bot]

Maybe the following could be replaced by app.shell.currentWidget?

https://github.com/jupyterlab/jupyter-ai/blob/9c69a7b851d46a66bb9664b4b906bdd7e55e984e/packages/jupyter-ai/src/selection-watcher.ts#L108

Since currentWidget is part of the JupyterFrontEnd.IShell interface:

  • https://jupyterlab.readthedocs.io/en/latest/api/interfaces/application.JupyterFrontEnd.IShell.html#currentWidget
  • https://github.com/jupyterlab/jupyterlab/blob/846a7b06b4d9ae098035987a9573258adc116b58/packages/application/src/frontend.ts#L277

jtpio avatar Dec 05 '23 10:12 jtpio

Thanks for bringing this up. We have some early UX designs for a slightly different (optional) UX that would work well in notebook. Certainly the inline completer stuff in #465 should work in notebook, but we would like to have a chat experience as well. @andrii-i do you have some of the UX mocks we did for the lightweight chat UX for cells (I think we called in a "popup UX" or something?

ellisonbg avatar Dec 05 '23 19:12 ellisonbg

Here are mockups for "in-editor dialog/popup UI" as we call it:

  1. On in-editor text selection or text area interaction, icon to the left of the cell appears image

  2. When icon is clicked, in-editor Jupyter AI dialog/popup UI appears image

Please also see relevant issue

  • #288

andrii-i avatar Dec 06 '23 03:12 andrii-i

Just FYI, the chat could already by placed in the left or right sidebar:

image

image

I think that the selection-oriented pop-up could be very useful for reformatting and infill tasks (and not hard to implement given CodeMirror6 uses its own, programmatic selection layer). I could also see the chat as optionally configurable mini-window that can be dragged around, though if you are interested in enabling users today, placing the chat in the sidebar is a no-brainer.

krassowski avatar Dec 22 '23 16:12 krassowski