-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Adds experimental.OpenAIModel #2637
Conversation
5b66a96
to
e7fb3e4
Compare
683e92c
to
8bb61b5
Compare
This builds, linting passes, I was able to debug it and to see the model reflect in the debugger after specifying it in the configs (I tested with Untitled.mov |
src/ai/openaiProvider.ts
Outdated
|
||
constructor(private readonly container: Container) {} | ||
|
||
dispose() {} | ||
|
||
async generateCommitMessage(diff: string, options?: { context?: string }): Promise<string | undefined> { | ||
this.model = configuration.get('experimental.openAIModel') || 'gpt-3.5-turbo'; |
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.
Could pull this code into its own method (something like ensureModel
) which is (force = false): void
.
this.model = configuration.get('experimental.openAIModel') || 'gpt-3.5-turbo'; | |
this.ensureModel(); |
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.
To take that a step further, you could hook up a listener for config changes in the constructor. Something like:
constructor(private readonly container: Container) {
this._disposable = [
configuration.onDidChange(this.onConfigurationChanged, this),
];
}
private onConfigurationChanged(e?: ConfigurationChangeEvent) {
if (!configuration.changed(e, 'experimental.openAIModel')) return;
this.ensureModel(true);
}
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.
Sorry, @d13 ! I focused on something else. I should have followed up sooner.
- Moves AI settings into a new AI section - Renames new setting into a `gitlens.ai` namespace and changes it to be an enum for easier selection - Updates max characters to be dependent on selected model
8bb61b5
to
3b83b25
Compare
Thank you all! I'll try to come back to this repo more often 🙇♂️ |
Description
Adds a
gitlens.experimental.OpenAIModel
setting to specify the OpenAI model to use to generate commit messages when using theGitLens: Generate Commit Message
command.Fixes #2636
Checklist
Fixes $XXX -
orCloses #XXX -
prefix to auto-close the issue that your PR addresses