Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Exports tokens from
lib/index.js
to allow labextension configuration.Motivation
I was not able to configure a custom message footer (#942) by providing the
IJaiMessageFooter
token in a separate labextension, scaffolded via the latestextension-template
.In my custom extension, I imported the tokens from
@jupyter-ai/core/lib/tokens
and defined a plugin that provided theIJaiMessageFooter
token. I also added this to mypackage.json
file, according to the labextension docs:However, this did not add a custom message footer to the chat messages, and I received an error message in the browser console:
After doing a bit of digging, I noticed that all other labextensions re-export their tokens from
src/index.ts
, so you can import the tokens from the package directly (instead of a module within that package). I made the code changes injupyter-ai
, built new JavaScript & Python packages viajupyter-releaser
and installed these locally.Then, I updated the import in my extension to:
Finally, I rebuilt my extension. To my surprise, this worked! I could see the new message footer in the chat UI.
It seems that tokens must be imported from a package's main file,
lib/index.js
. Otherwise, the tokens aren't available as a shared singleton module.