-
Notifications
You must be signed in to change notification settings - Fork 37.5k
Rename fix for disposed models #286470
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
base: main
Are you sure you want to change the base?
Rename fix for disposed models #286470
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -243,6 +243,16 @@ export class ChatService extends Disposable implements IChatService { | |||||||||||||
| const model = this._sessionModels.get(sessionResource); | ||||||||||||||
| if (model) { | ||||||||||||||
| model.setCustomTitle(title); | ||||||||||||||
| } else { | ||||||||||||||
| let modelRef: IChatModelReference | undefined; | ||||||||||||||
| try { | ||||||||||||||
| modelRef = await this.getOrRestoreSession(sessionResource); | ||||||||||||||
| modelRef?.object.setCustomTitle(title); | ||||||||||||||
|
||||||||||||||
| modelRef?.object.setCustomTitle(title); | |
| if (modelRef) { | |
| modelRef.object.setCustomTitle(title); | |
| } else { | |
| this.trace('setChatSessionTitle', `Could not restore session ${sessionResource.toString()} to set title`); | |
| } |
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.
TBH doing this seems a bit silly to me, just restore the chat model to update the title and dispose it, futher down then updating the store.
@roblourens when reviving a chat model, do we take the title from the store? If so maybe we just need to fire
onDidChangeevent without the need of creating the modelRefThere 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.
I think the title is already in the index to avoid having to do this. I think the problem is just that when loading a model, we should take the title from the index and let it overwrite the one in the stored model.
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.
And I believe the block below this (
// Update the title in the file storage) can be in theelsefromif (model)