-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Define a new framework for chat commands #161
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dlqqq for working on it.
I left some comments below.
packages/jupyter-chat/src/components/input/use-chat-commands.tsx
Outdated
Show resolved
Hide resolved
In a more general test, I saw 2 issues in usages, that can be seen in the following screencast:
record-2025-02-14_14.00.16.webm |
Demo of latest branch state. Screen.Recording.2025-02-14.at.2.12.21.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dlqqq for updating the PR, I can't reproduce the issues anymore 👍 .
@brichet I've removed the old files. 👍 |
Finally finished opening all of the follow-up issues raised by other reviewers and me! Thank you all for taking the time to review this & ask questions. 🤗 |
Not sure it's the same failure. Based on @brichet's comment above (#161 (comment)) it seems related to the previous autocompletion registry implementation: Ideally we should be able to update these tests? If it's too much effort for now, maybe worth disabling / removing them for now, but track adding them back in an issue? |
Nice thank! So let's remove or disable the outdated test code in this PR? After #148 the CI should normally be passing more consistently again (with skipped tests). And to lower maintenance burden it's nice to have a green check even though we know some tests have been disabled (it's easier to merge other PRs). |
@jtpio Good idea, I'll do that now. |
@jtpio Done! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Implements a new framework for chat commands, following the design proposed in Design proposal: Chat Completions API (rev. 1.1) #144.
Closes Design proposal: Chat Completions API (rev. 1.1) #144.
Implements a new chat commands menu UI, which shows commands matching the current word the user is typing.
Allows consumer extensions to provide multiple commands that have multiple patterns.
Allows consumer extensions to define how commands are handled from the frontend. No server code necessary.
Extended description
This PR introduces a modular and extensible framework for defining chat commands. To do so, this PR implements a
ChatCommandRegistry
singleton, which is provided to other lab extensions. Extensions can request this to add one or more chat command providers to the registry. Providers implement theIChatCommandProvider
interface. Once added, each provider provides a set of commands to the command menu, and defines how those commands are handled.This PR only aims to provide a minimal implementation of this design for further iteration. There are several known shortcomings with this PR currently, which I've documented as follow-up items after the demo section.
Demo
In this PR, 2 command providers are defined for demo purposes: one for slash commands, and one for emojis.
Screen.Recording.2025-02-10.at.4.05.15.PM.mov
The demo shows how this PR implements new features previously not possible in Jupyter AI or Jupyter Chat:
Follow-up items
Roughly ordered in descending priority, i.e. most important first, least important last.
Subissue: Lift chat input state to
ChatModel
#163Subissue: Show icons & descriptions in chat commands menu #175
Subissue: Remove old autocomplete framework #168
Subissue: Allow command providers to be initialized async #174
Subissue: Improve support for async command providers #167
Subissue: Do not show commands menu when user is typing literally #176
Subissue: Consider triggering commands on type #177