Skip to content

Commit acb0fbc

Browse files
committed
Use ChatModel.IOptions in model factory
1 parent 2aab052 commit acb0fbc

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

packages/jupyterlab-chat/src/factory.ts

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,9 @@
33
* Distributed under the terms of the Modified BSD License.
44
*/
55

6-
import {
7-
Chat,
8-
ChatWidget,
9-
IActiveCellManager,
10-
ISelectionWatcher,
11-
IInputToolbarRegistryFactory
12-
} from '@jupyter/chat';
13-
import { IDocumentManager } from '@jupyterlab/docmanager';
6+
import { Chat, ChatWidget, IInputToolbarRegistryFactory } from '@jupyter/chat';
147
import { ABCWidgetFactory, DocumentRegistry } from '@jupyterlab/docregistry';
15-
import { Contents, User } from '@jupyterlab/services';
16-
import { CommandRegistry } from '@lumino/commands';
8+
import { Contents } from '@jupyterlab/services';
179
import { ISignal, Signal } from '@lumino/signaling';
1810

1911
import { LabChatModel } from './model';
@@ -123,12 +115,7 @@ export class LabChatModelFactory
123115
implements DocumentRegistry.IModelFactory<LabChatModel>
124116
{
125117
constructor(options: LabChatModel.IOptions) {
126-
this._user = options.user;
127-
this._widgetConfig = options.widgetConfig;
128-
this._commands = options.commands;
129-
this._activeCellManager = options.activeCellManager ?? null;
130-
this._selectionWatcher = options.selectionWatcher ?? null;
131-
this._documentManager = options.documentManager ?? null;
118+
this._modelOptions = options;
132119
}
133120

134121
collaborative = true;
@@ -197,20 +184,10 @@ export class LabChatModelFactory
197184
createNew(options: DocumentRegistry.IModelOptions<YChat>): LabChatModel {
198185
return new LabChatModel({
199186
...options,
200-
user: this._user,
201-
widgetConfig: this._widgetConfig,
202-
commands: this._commands,
203-
activeCellManager: this._activeCellManager,
204-
selectionWatcher: this._selectionWatcher,
205-
documentManager: this._documentManager
187+
...this._modelOptions
206188
});
207189
}
208190

209191
private _disposed = false;
210-
private _user: User.IIdentity | null;
211-
private _widgetConfig: IWidgetConfig;
212-
private _commands?: CommandRegistry;
213-
private _activeCellManager: IActiveCellManager | null;
214-
private _selectionWatcher: ISelectionWatcher | null;
215-
private _documentManager: IDocumentManager | null;
192+
private _modelOptions: Omit<LabChatModel.IOptions, 'sharedModel'>;
216193
}

0 commit comments

Comments
 (0)