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

Autocomplete frontend fixes #583

Merged
merged 12 commits into from
Jan 19, 2024

Conversation

dlqqq
Copy link
Member

@dlqqq dlqqq commented Jan 16, 2024

Description

I've structured this branch to be easy to review; reviewers should be able to follow this branch commit-by-commit.

  • Removes duplicate definition of plugin

  • Renames a lot of variables to be more similar to their function / type

    • inlineCompletionProvider (plugin) => completionPlugin
    • jupyternautStatus (plugin) => statusItemPlugin
    • IJupyternautStatus (token + interface) => IJaiStatusItem
    • I removed the references to Jupyternaut because that plugin is not specific to Jupyternaut. Its functional purpose is to serve as a status item for Jupyter AI.
  • Fix issue where users are not able to edit settings on a fresh installation

Screenshot 2023-12-29 at 11 41 09 AM
  • Have the autocomplete feature (but not the plugin) disabled by default

@dlqqq dlqqq added bug Something isn't working enhancement New feature or request labels Jan 16, 2024
@dlqqq
Copy link
Member Author

dlqqq commented Jan 17, 2024

@krassowski I suddenly ran into some issues while developing my branch. I'm not sure that it's due to any code change from my end however, since none of my console.log() statements are reached when I add them to the completion plugin source (completions/provider.ts), even at the top-level scope. 🤔

Specifically, I'm seeing this error in the console, which occurs before completionPlugin.activate() is called:

Screenshot 2024-01-16 at 5 24 01 PM

When I try bumping the version of @jupyterlab/completer to 4.1.0-beta.0, I am no longer able to build the project:

Screenshot 2024-01-16 at 5 50 51 PM

Just wanted to check in to see if you knew a quick fix for this. No pressure though; I can figure this out myself tomorrow.

@dlqqq
Copy link
Member Author

dlqqq commented Jan 17, 2024

I've tried fixing my dependencies by using only JupyterLab v4.1.0-beta.0 packages (referencing the staging manifest in jupyterlab/staging/package.json to get the correct versions). This should work, but Webpack still keeps thinking that I have jupyterlab==4.0.* installed locally:

Screenshot 2024-01-17 at 10 09 41 AM

@krassowski
Copy link
Member

What version do you see in help menu -> about?

@dlqqq
Copy link
Member Author

dlqqq commented Jan 17, 2024

v4.1.0b0 🤔

Screenshot 2024-01-17 at 10 40 28 AM

@dlqqq
Copy link
Member Author

dlqqq commented Jan 17, 2024

I've pushed the work that I've gotten done so far. Given that I still don't have an explanation for why I'm unable to build this branch now, I admit that it may just be an error with my recent code changes, and that the warnings may be unrelated.

I have to take a quick break to patch the Cohere provider and then cut a patch release. Will be back tomorrow. 👋

Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

I pulled your changes and was able to build both ff197cf and cfa8144 (after installing langchain-community dependency) without an issue. The former worked well, but cfa8144 introduces a bug because you are attempting to load the settings for @jupyterlab/completer-extension:inline-completer too early, which results in:

jupyterlab/completer-extension:inline-completer has no transformers yet

error.

As for your build issue, I suspect that you either:

  • have some stale artefacts in packages/jupyter-ai/jupyter_ai/labextension/static/
  • have a broken state in node_modules (e.g. due to interrupted install or such).

Force-removing them followed by clean install and build will likely help, but if not I would then recommend trying in a new clean environment.

packages/jupyter-ai/src/completions/plugin.ts Outdated Show resolved Hide resolved
@dlqqq
Copy link
Member Author

dlqqq commented Jan 18, 2024

@krassowski I was actually able to build the branch as of the latest commit yesterday, but I misspoke because I was really tired that afternoon. My comment was in reference to the console warnings I am still seeing but now appear to be unrelated.

I replied to your explanation above for why this branch is failing at runtime, let's continue the discussion there. 🤗

@dlqqq
Copy link
Member Author

dlqqq commented Jan 19, 2024

@krassowski

This PR is ready for review. Here's a quick demo video of what it looks like.

Screen.Recording.2024-01-19.at.10.51.19.AM.mov

@dlqqq dlqqq changed the title [WIP] Autocomplete frontend fixes Autocomplete frontend fixes Jan 19, 2024
@dlqqq dlqqq marked this pull request as ready for review January 19, 2024 19:03
@dlqqq dlqqq force-pushed the autocomplete-frontend-tweaks branch from ee7b9cd to 07827f6 Compare January 19, 2024 19:11
@dlqqq
Copy link
Member Author

dlqqq commented Jan 19, 2024

Once this is merged, I will rebase the autocomplete branch and do a final review. If everything looks good, I'll merge and cut a pre-release. 👍

Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Some tiny suggestions

packages/jupyter-ai/src/completions/plugin.ts Outdated Show resolved Hide resolved
packages/jupyter-ai/src/completions/plugin.ts Outdated Show resolved Hide resolved
packages/jupyter-ai/package.json Show resolved Hide resolved
packages/jupyter-ai/src/components/statusbar-item.tsx Outdated Show resolved Hide resolved
dlqqq and others added 2 commits January 19, 2024 12:47
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
@dlqqq
Copy link
Member Author

dlqqq commented Jan 19, 2024

@krassowski Thanks for the edits! I addressed your comments above. 👍

Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Thank you @dlqqq!

@dlqqq dlqqq merged commit 476c7d2 into jupyterlab:autocomplete Jan 19, 2024
8 checks passed
dlqqq added a commit that referenced this pull request Jan 19, 2024
* remove duplicate definition of inline completion provider

* rename completion variables, plugins, token to be more accurate

* abbreviate JupyterAIInlineProvider => JaiInlineProvider

* bump @jupyterlab/completer and typescript

* WIP: fix Jupyter AI completion settings

* Fix issues with settings population

* read from settings directly instead of using a cache

* disable Jupyter AI completion by default

* improve completion plugin menu items

* revert unnecessary edits to package manifest

* Update packages/jupyter-ai/src/components/statusbar-item.tsx

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>

* tweak wording

---------

Co-authored-by: krassowski <5832902+krassowski@users.noreply.github.com>
dlqqq added a commit that referenced this pull request Jan 19, 2024
* Inline code completions (#465)

* Draft inline completions implementation (server side)

* Implement inline completion provider (front)

* Add default debounce delay and error handling (front)

* Add `gpt-3.5-turbo-instruct` because text- models are deprecated.

OpenAI specifically recommends using `gpt-3.5-turbo-instruct` in
favour of text-davinci, text-ada, etc. See:
https://platform.openai.com/docs/deprecations/

* Improve/fix prompt template and add simple post-processing

* Handle missing `registerInlineProvider`, handle no model in name

* Remove IPython mention to avoid confusing languages

* Disable suggestions in markdown, move language logic

* Remove unused background and clip path from jupyternaut

* Implement toggling the AI completer via statusbar item

also adds the icon for provider re-using jupyternaut icon

* Implement streaming support

* Translate ipython to python for models, remove log

* Move `BaseLLMHandler` to `/completions` rename to `LLMHandlerMixin`

* Move frontend completions code to `/completions`

* Make `IStatusBar` required for now, lint

* Simplify inline completion backend (#553)

* do not import from pydantic directly

* refactor inline completion backend

* Autocomplete frontend fixes (#583)

* remove duplicate definition of inline completion provider

* rename completion variables, plugins, token to be more accurate

* abbreviate JupyterAIInlineProvider => JaiInlineProvider

* bump @jupyterlab/completer and typescript

* WIP: fix Jupyter AI completion settings

* Fix issues with settings population

* read from settings directly instead of using a cache

* disable Jupyter AI completion by default

* improve completion plugin menu items

* revert unnecessary edits to package manifest

* Update packages/jupyter-ai/src/components/statusbar-item.tsx

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>

* tweak wording

---------

Co-authored-by: krassowski <5832902+krassowski@users.noreply.github.com>

---------

Co-authored-by: David L. Qiu <david@qiu.dev>
Comment on lines +162 to +163
? `Disable completions in ${displayName(language)}`
: 'Disable completions in <language> files';
Copy link
Member

Choose a reason for hiding this comment

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

Ah, this switch gave me confusion as a user. All other UI elements in JupyterLab use positive mode.

@dlqqq dlqqq mentioned this pull request Jan 30, 2024
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* Inline code completions (jupyterlab#465)

* Draft inline completions implementation (server side)

* Implement inline completion provider (front)

* Add default debounce delay and error handling (front)

* Add `gpt-3.5-turbo-instruct` because text- models are deprecated.

OpenAI specifically recommends using `gpt-3.5-turbo-instruct` in
favour of text-davinci, text-ada, etc. See:
https://platform.openai.com/docs/deprecations/

* Improve/fix prompt template and add simple post-processing

* Handle missing `registerInlineProvider`, handle no model in name

* Remove IPython mention to avoid confusing languages

* Disable suggestions in markdown, move language logic

* Remove unused background and clip path from jupyternaut

* Implement toggling the AI completer via statusbar item

also adds the icon for provider re-using jupyternaut icon

* Implement streaming support

* Translate ipython to python for models, remove log

* Move `BaseLLMHandler` to `/completions` rename to `LLMHandlerMixin`

* Move frontend completions code to `/completions`

* Make `IStatusBar` required for now, lint

* Simplify inline completion backend (jupyterlab#553)

* do not import from pydantic directly

* refactor inline completion backend

* Autocomplete frontend fixes (jupyterlab#583)

* remove duplicate definition of inline completion provider

* rename completion variables, plugins, token to be more accurate

* abbreviate JupyterAIInlineProvider => JaiInlineProvider

* bump @jupyterlab/completer and typescript

* WIP: fix Jupyter AI completion settings

* Fix issues with settings population

* read from settings directly instead of using a cache

* disable Jupyter AI completion by default

* improve completion plugin menu items

* revert unnecessary edits to package manifest

* Update packages/jupyter-ai/src/components/statusbar-item.tsx

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>

* tweak wording

---------

Co-authored-by: krassowski <5832902+krassowski@users.noreply.github.com>

---------

Co-authored-by: David L. Qiu <david@qiu.dev>
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Inline code completions (jupyterlab#465)

* Draft inline completions implementation (server side)

* Implement inline completion provider (front)

* Add default debounce delay and error handling (front)

* Add `gpt-3.5-turbo-instruct` because text- models are deprecated.

OpenAI specifically recommends using `gpt-3.5-turbo-instruct` in
favour of text-davinci, text-ada, etc. See:
https://platform.openai.com/docs/deprecations/

* Improve/fix prompt template and add simple post-processing

* Handle missing `registerInlineProvider`, handle no model in name

* Remove IPython mention to avoid confusing languages

* Disable suggestions in markdown, move language logic

* Remove unused background and clip path from jupyternaut

* Implement toggling the AI completer via statusbar item

also adds the icon for provider re-using jupyternaut icon

* Implement streaming support

* Translate ipython to python for models, remove log

* Move `BaseLLMHandler` to `/completions` rename to `LLMHandlerMixin`

* Move frontend completions code to `/completions`

* Make `IStatusBar` required for now, lint

* Simplify inline completion backend (jupyterlab#553)

* do not import from pydantic directly

* refactor inline completion backend

* Autocomplete frontend fixes (jupyterlab#583)

* remove duplicate definition of inline completion provider

* rename completion variables, plugins, token to be more accurate

* abbreviate JupyterAIInlineProvider => JaiInlineProvider

* bump @jupyterlab/completer and typescript

* WIP: fix Jupyter AI completion settings

* Fix issues with settings population

* read from settings directly instead of using a cache

* disable Jupyter AI completion by default

* improve completion plugin menu items

* revert unnecessary edits to package manifest

* Update packages/jupyter-ai/src/components/statusbar-item.tsx

Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>

* tweak wording

---------

Co-authored-by: krassowski <5832902+krassowski@users.noreply.github.com>

---------

Co-authored-by: David L. Qiu <david@qiu.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants