-
Notifications
You must be signed in to change notification settings - Fork 3
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
Settings UI improvement #48
Conversation
This PR is missing some helpers about the use of each provider, as described in #35 (comment). Since this is using a |
Instructions added to the settings (currently only for record-2025-02-27_13.15.05.webm |
The instructions are displayed using the markdown renderer from Jupyterlab, provided by |
Thanks for looking into this 👍 Having a way to provide more parameters would indeed also be useful to pass a secret manager (#37), so the secrets could be saved elsewhere. For now I guess we can use the trick of the static method, but maybe there is something so be done in JupyterLab to make this more flexible. |
[key: string]: T; | ||
} | ||
|
||
const chromeAiInstructions = ` |
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.
Probably fine to leave them here in one file here for now.
Later when third-party extensions can register additional AI providers (#45) they could also provide their own instructions for their provider.
* Get the current provider from the local storage. | ||
*/ | ||
getCurrentProvider(): string { | ||
const settings = JSON.parse(localStorage.getItem(STORAGE_NAME) || '{}'); |
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.
Wondering how this would play with a custom overrides.json
, in case some deployments would like to pre-configure a model (and some of its options) by default?
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.
That would probably overwrite it.
I don't really know how works overrides.json
. Can we get its default values with annotatedDefaults()
?
In this case we could simply replace '{}'
with this._settingsRegistry.annotatedDefaults()
.
BTW, we should probably rename this._settingsRegistry
to this.settings
for consistency.
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.
Looks like annotatedDefaults()
returns the overrides.json
contents.
In the constructor, we could check if there is a value in localStorage.getItem(STORAGE_NAME)
.
If not, read the annotatedDefaults()
and, if the provider is set in the default settings, fill the local storage with its contents and set the default provider as current. If the provider is not set in the default settings we can probably not use these values.
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.
@jtpio I updated the PR according to my previous comment, using this._settings.default('AIprovider')
instead of this._settingsRegistry.annotatedDefaults()
.
…he provider select)
… able to add some helper between them
@jtpio this PR is ready.
|
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!
Fixes #35
record-2025-02-20_18.17.07.webm
This PR uses a react component in the settings panel, to make it more reactive and configurable.
With this new setting component:
It also use a simpler way to import generated schema, no need to set it up manually when adding a new provider.