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 chat autocompletion and the /clear command #41

Merged
merged 7 commits into from
Feb 14, 2025

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Feb 13, 2025

Slash commands are useful to perform regular actions, such as clearing the history of messages.

This adds a IAutocompletionRegistry to register /clear and be able to clear the chat history.

jupyterlite-ai-clear-command.mp4

@jtpio jtpio added the enhancement New feature or request label Feb 13, 2025
@jtpio
Copy link
Member Author

jtpio commented Feb 13, 2025

We may also need to apply the same trick as in jupyterlab/jupyter-chat#159.

@jtpio jtpio changed the title Add chat autocompletion with the /clear command Add chat autocompletion and the /clear command Feb 13, 2025
@brichet
Copy link
Collaborator

brichet commented Feb 13, 2025

Thanks for looking into it @jtpio.

FYI there may be some changes in the way the autocompletion are handled and registered in jupyter-chat:

@jtpio
Copy link
Member Author

jtpio commented Feb 14, 2025

FYI there may be some changes in the way the autocompletion are handled and registered in jupyter-chat:

Thanks for the heads-up. Sounds good, we can adapt here after updating to a new version of jupyter-chat.

@jtpio jtpio marked this pull request as ready for review February 14, 2025 08:54
@brichet
Copy link
Collaborator

brichet commented Feb 14, 2025

There seems to be an issue with keyboard when displaying and hiding the completer suggestion.
In the example below, pressing enter should send the message, but does not work anymore if the autocomplion has been opened

record-2025-02-14_11.13.18.webm

I think that it is an issue with jupyter-chat, I will make some tests there.

@brichet
Copy link
Collaborator

brichet commented Feb 14, 2025

We should also clear the message history this._history.messages, to avoid sending cleared messages.

This makes me realize that the history seems to never be cleared, which could lead to a huge message list. I'll open an issue on this.

@jtpio
Copy link
Member Author

jtpio commented Feb 14, 2025

In the example below, pressing enter should send the message, but does not work anymore if the autocomplion has been opened

It also seems to be an issue with the Jupyter AI v3 pre-release. For example when testing from the main branch of https://github.com/jupyterlab/jupyter-ai:

jupyter-chat-enter-key-issue.mp4

So yes, it is likely an issue in jupyter-chat.

Copy link
Collaborator

@brichet brichet left a comment

Choose a reason for hiding this comment

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

Thanks @jtpio, looks great.

I also tested the linting error on MUI icons, it works well 👍

@brichet brichet merged commit f2259dc into jupyterlite:main Feb 14, 2025
7 checks passed
@jtpio jtpio deleted the autocomplete branch February 14, 2025 19:40
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