jupyterlab-chat 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/factory.d.ts +6 -4
- package/lib/factory.js +8 -4
- package/lib/model.d.ts +4 -0
- package/lib/model.js +6 -0
- package/lib/token.d.ts +14 -1
- package/lib/token.js +4 -0
- package/lib/widget.d.ts +3 -3
- package/lib/widget.js +8 -3
- package/package.json +2 -2
- package/src/factory.ts +17 -6
- package/src/model.ts +7 -0
- package/src/token.ts +20 -1
- package/src/widget.tsx +17 -7
- package/style/base.css +0 -10
package/lib/factory.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAttachmentOpenerRegistry, IChatCommandRegistry } from '@jupyter/chat';
|
|
1
|
+
import { IAttachmentOpenerRegistry, IChatCommandRegistry, IInputToolbarRegistry } from '@jupyter/chat';
|
|
2
2
|
import { IThemeManager } from '@jupyterlab/apputils';
|
|
3
3
|
import { IDocumentManager } from '@jupyterlab/docmanager';
|
|
4
4
|
import { ABCWidgetFactory, DocumentRegistry } from '@jupyterlab/docregistry';
|
|
@@ -8,7 +8,7 @@ import { ISignal } from '@lumino/signaling';
|
|
|
8
8
|
import { LabChatModel } from './model';
|
|
9
9
|
import { LabChatPanel } from './widget';
|
|
10
10
|
import { YChat } from './ychat';
|
|
11
|
-
import { ILabChatConfig, IWidgetConfig } from './token';
|
|
11
|
+
import { IInputToolbarRegistryFactory, ILabChatConfig, IWidgetConfig } from './token';
|
|
12
12
|
/**
|
|
13
13
|
* The object provided by the chatDocument extension.
|
|
14
14
|
* It is used to set the current config (from settings) to newly created chat widget,
|
|
@@ -50,9 +50,9 @@ export declare class ChatWidgetFactory extends ABCWidgetFactory<LabChatPanel, La
|
|
|
50
50
|
protected createNewWidget(context: ChatWidgetFactory.IContext): LabChatPanel;
|
|
51
51
|
private _themeManager;
|
|
52
52
|
private _rmRegistry;
|
|
53
|
-
private _documentManager?;
|
|
54
53
|
private _chatCommandRegistry?;
|
|
55
54
|
private _attachmentOpenerRegistry?;
|
|
55
|
+
private _inputToolbarRegistry?;
|
|
56
56
|
}
|
|
57
57
|
export declare namespace ChatWidgetFactory {
|
|
58
58
|
interface IContext extends DocumentRegistry.IContext<LabChatModel> {
|
|
@@ -61,13 +61,14 @@ export declare namespace ChatWidgetFactory {
|
|
|
61
61
|
documentManager?: IDocumentManager;
|
|
62
62
|
chatCommandRegistry?: IChatCommandRegistry;
|
|
63
63
|
attachmentOpenerRegistry?: IAttachmentOpenerRegistry;
|
|
64
|
+
inputToolbarRegistry?: IInputToolbarRegistry;
|
|
64
65
|
}
|
|
65
66
|
interface IOptions<T extends LabChatPanel> extends DocumentRegistry.IWidgetFactoryOptions<T> {
|
|
66
67
|
themeManager: IThemeManager | null;
|
|
67
68
|
rmRegistry: IRenderMimeRegistry;
|
|
68
|
-
documentManager?: IDocumentManager;
|
|
69
69
|
chatCommandRegistry?: IChatCommandRegistry;
|
|
70
70
|
attachmentOpenerRegistry?: IAttachmentOpenerRegistry;
|
|
71
|
+
inputToolbarFactory?: IInputToolbarRegistryFactory;
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
export declare class LabChatModelFactory implements DocumentRegistry.IModelFactory<LabChatModel> {
|
|
@@ -122,4 +123,5 @@ export declare class LabChatModelFactory implements DocumentRegistry.IModelFacto
|
|
|
122
123
|
private _commands?;
|
|
123
124
|
private _activeCellManager;
|
|
124
125
|
private _selectionWatcher;
|
|
126
|
+
private _documentManager;
|
|
125
127
|
}
|
package/lib/factory.js
CHANGED
|
@@ -50,9 +50,11 @@ export class ChatWidgetFactory extends ABCWidgetFactory {
|
|
|
50
50
|
super(options);
|
|
51
51
|
this._themeManager = options.themeManager;
|
|
52
52
|
this._rmRegistry = options.rmRegistry;
|
|
53
|
-
this._documentManager = options.documentManager;
|
|
54
53
|
this._chatCommandRegistry = options.chatCommandRegistry;
|
|
55
54
|
this._attachmentOpenerRegistry = options.attachmentOpenerRegistry;
|
|
55
|
+
if (options.inputToolbarFactory) {
|
|
56
|
+
this._inputToolbarRegistry = options.inputToolbarFactory.create();
|
|
57
|
+
}
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* Create a new widget given a context.
|
|
@@ -63,9 +65,9 @@ export class ChatWidgetFactory extends ABCWidgetFactory {
|
|
|
63
65
|
createNewWidget(context) {
|
|
64
66
|
context.rmRegistry = this._rmRegistry;
|
|
65
67
|
context.themeManager = this._themeManager;
|
|
66
|
-
context.documentManager = this._documentManager;
|
|
67
68
|
context.chatCommandRegistry = this._chatCommandRegistry;
|
|
68
69
|
context.attachmentOpenerRegistry = this._attachmentOpenerRegistry;
|
|
70
|
+
context.inputToolbarRegistry = this._inputToolbarRegistry;
|
|
69
71
|
return new LabChatPanel({
|
|
70
72
|
context,
|
|
71
73
|
content: new ChatWidget(context)
|
|
@@ -74,7 +76,7 @@ export class ChatWidgetFactory extends ABCWidgetFactory {
|
|
|
74
76
|
}
|
|
75
77
|
export class LabChatModelFactory {
|
|
76
78
|
constructor(options) {
|
|
77
|
-
var _a, _b;
|
|
79
|
+
var _a, _b, _c;
|
|
78
80
|
this.collaborative = true;
|
|
79
81
|
this._disposed = false;
|
|
80
82
|
this._user = options.user;
|
|
@@ -82,6 +84,7 @@ export class LabChatModelFactory {
|
|
|
82
84
|
this._commands = options.commands;
|
|
83
85
|
this._activeCellManager = (_a = options.activeCellManager) !== null && _a !== void 0 ? _a : null;
|
|
84
86
|
this._selectionWatcher = (_b = options.selectionWatcher) !== null && _b !== void 0 ? _b : null;
|
|
87
|
+
this._documentManager = (_c = options.documentManager) !== null && _c !== void 0 ? _c : null;
|
|
85
88
|
}
|
|
86
89
|
/**
|
|
87
90
|
* The name of the model.
|
|
@@ -144,7 +147,8 @@ export class LabChatModelFactory {
|
|
|
144
147
|
widgetConfig: this._widgetConfig,
|
|
145
148
|
commands: this._commands,
|
|
146
149
|
activeCellManager: this._activeCellManager,
|
|
147
|
-
selectionWatcher: this._selectionWatcher
|
|
150
|
+
selectionWatcher: this._selectionWatcher,
|
|
151
|
+
documentManager: this._documentManager
|
|
148
152
|
});
|
|
149
153
|
}
|
|
150
154
|
}
|
package/lib/model.d.ts
CHANGED
|
@@ -40,6 +40,10 @@ export declare class LabChatModel extends ChatModel implements DocumentRegistry.
|
|
|
40
40
|
fromJSON(data: PartialJSONObject): void;
|
|
41
41
|
messagesInserted(index: number, messages: IChatMessage[]): void;
|
|
42
42
|
sendMessage(message: INewMessage): Promise<boolean | void> | boolean | void;
|
|
43
|
+
/**
|
|
44
|
+
* Override the clear messages method.
|
|
45
|
+
*/
|
|
46
|
+
clearMessages(): void;
|
|
43
47
|
updateMessage(id: string, updatedMessage: IChatMessage): Promise<boolean | void> | boolean | void;
|
|
44
48
|
deleteMessage(id: string): Promise<boolean | void> | boolean | void;
|
|
45
49
|
/**
|
package/lib/model.js
CHANGED
|
@@ -210,6 +210,12 @@ export class LabChatModel extends ChatModel {
|
|
|
210
210
|
}
|
|
211
211
|
this.sharedModel.addMessage(msg);
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Override the clear messages method.
|
|
215
|
+
*/
|
|
216
|
+
clearMessages() {
|
|
217
|
+
// No-op as we may not need to clear the messages in file based chat.
|
|
218
|
+
}
|
|
213
219
|
updateMessage(id, updatedMessage) {
|
|
214
220
|
var _a;
|
|
215
221
|
const index = this.sharedModel.getMessageIndex(id);
|
package/lib/token.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IConfig, IActiveCellManager, ISelectionWatcher, ChatWidget } from '@jupyter/chat';
|
|
1
|
+
import { IConfig, IActiveCellManager, ISelectionWatcher, ChatWidget, IInputToolbarRegistry } from '@jupyter/chat';
|
|
2
2
|
import { WidgetTracker } from '@jupyterlab/apputils';
|
|
3
3
|
import { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
4
4
|
import { Token } from '@lumino/coreutils';
|
|
@@ -89,3 +89,16 @@ export declare const IActiveCellManagerToken: Token<IActiveCellManager>;
|
|
|
89
89
|
* The selection watcher plugin.
|
|
90
90
|
*/
|
|
91
91
|
export declare const ISelectionWatcherToken: Token<ISelectionWatcher>;
|
|
92
|
+
/**
|
|
93
|
+
* The input toolbar registry factory.
|
|
94
|
+
*/
|
|
95
|
+
export interface IInputToolbarRegistryFactory {
|
|
96
|
+
/**
|
|
97
|
+
* Create an input toolbar registry.
|
|
98
|
+
*/
|
|
99
|
+
create: () => IInputToolbarRegistry;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The token of the factory to create an input toolbar registry.
|
|
103
|
+
*/
|
|
104
|
+
export declare const IInputToolbarRegistryFactory: Token<IInputToolbarRegistryFactory>;
|
package/lib/token.js
CHANGED
|
@@ -57,3 +57,7 @@ export const IActiveCellManagerToken = new Token('jupyterlab-chat:IActiveCellMan
|
|
|
57
57
|
* The selection watcher plugin.
|
|
58
58
|
*/
|
|
59
59
|
export const ISelectionWatcherToken = new Token('jupyterlab-chat:ISelectionWatcher');
|
|
60
|
+
/**
|
|
61
|
+
* The token of the factory to create an input toolbar registry.
|
|
62
|
+
*/
|
|
63
|
+
export const IInputToolbarRegistryFactory = new Token('jupyterlab-chat:IInputToolbarRegistryFactory');
|
package/lib/widget.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { CommandRegistry } from '@lumino/commands';
|
|
|
8
8
|
import { Message } from '@lumino/messaging';
|
|
9
9
|
import { Panel } from '@lumino/widgets';
|
|
10
10
|
import { LabChatModel } from './model';
|
|
11
|
-
import {
|
|
11
|
+
import { IInputToolbarRegistryFactory } from './token';
|
|
12
12
|
/**
|
|
13
13
|
* DocumentWidget: widget that represents the view or editor for a file type.
|
|
14
14
|
*/
|
|
@@ -88,9 +88,9 @@ export declare class ChatPanel extends SidePanel {
|
|
|
88
88
|
private _openChat;
|
|
89
89
|
private _rmRegistry;
|
|
90
90
|
private _themeManager;
|
|
91
|
-
private _documentManager?;
|
|
92
91
|
private _chatCommandRegistry?;
|
|
93
92
|
private _attachmentOpenerRegistry?;
|
|
93
|
+
private _inputToolbarFactory?;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* The chat panel namespace.
|
|
@@ -105,9 +105,9 @@ export declare namespace ChatPanel {
|
|
|
105
105
|
rmRegistry: IRenderMimeRegistry;
|
|
106
106
|
themeManager: IThemeManager | null;
|
|
107
107
|
defaultDirectory: string;
|
|
108
|
-
documentManager?: IDocumentManager;
|
|
109
108
|
chatCommandRegistry?: IChatCommandRegistry;
|
|
110
109
|
attachmentOpenerRegistry?: IAttachmentOpenerRegistry;
|
|
110
|
+
inputToolbarFactory?: IInputToolbarRegistryFactory;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
/**
|
package/lib/widget.js
CHANGED
|
@@ -105,9 +105,9 @@ export class ChatPanel extends SidePanel {
|
|
|
105
105
|
this._rmRegistry = options.rmRegistry;
|
|
106
106
|
this._themeManager = options.themeManager;
|
|
107
107
|
this._defaultDirectory = options.defaultDirectory;
|
|
108
|
-
this._documentManager = options.documentManager;
|
|
109
108
|
this._chatCommandRegistry = options.chatCommandRegistry;
|
|
110
109
|
this._attachmentOpenerRegistry = options.attachmentOpenerRegistry;
|
|
110
|
+
this._inputToolbarFactory = options.inputToolbarFactory;
|
|
111
111
|
const addChat = new CommandToolbarButton({
|
|
112
112
|
commands: this._commands,
|
|
113
113
|
id: CommandIDs.createChat,
|
|
@@ -152,14 +152,19 @@ export class ChatPanel extends SidePanel {
|
|
|
152
152
|
for (let i = 0; i < this.widgets.length; i++) {
|
|
153
153
|
content.collapse(i);
|
|
154
154
|
}
|
|
155
|
+
// Create the toolbar registry.
|
|
156
|
+
let inputToolbarRegistry;
|
|
157
|
+
if (this._inputToolbarFactory) {
|
|
158
|
+
inputToolbarRegistry = this._inputToolbarFactory.create();
|
|
159
|
+
}
|
|
155
160
|
// Create a new widget.
|
|
156
161
|
const widget = new ChatWidget({
|
|
157
162
|
model: model,
|
|
158
163
|
rmRegistry: this._rmRegistry,
|
|
159
164
|
themeManager: this._themeManager,
|
|
160
|
-
documentManager: this._documentManager,
|
|
161
165
|
chatCommandRegistry: this._chatCommandRegistry,
|
|
162
|
-
attachmentOpenerRegistry: this._attachmentOpenerRegistry
|
|
166
|
+
attachmentOpenerRegistry: this._attachmentOpenerRegistry,
|
|
167
|
+
inputToolbarRegistry
|
|
163
168
|
});
|
|
164
169
|
this.addWidget(new ChatSection({
|
|
165
170
|
widget,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyterlab-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "The library to build a chat based on shared document",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"watch:src": "tsc -w --sourceMap"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@jupyter/chat": "^0.
|
|
45
|
+
"@jupyter/chat": "^0.9.0",
|
|
46
46
|
"@jupyter/collaborative-drive": "^3.0.0",
|
|
47
47
|
"@jupyter/ydoc": "^2.0.0 || ^3.0.0",
|
|
48
48
|
"@jupyterlab/application": "^4.2.0",
|
package/src/factory.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
IActiveCellManager,
|
|
9
9
|
IAttachmentOpenerRegistry,
|
|
10
10
|
IChatCommandRegistry,
|
|
11
|
+
IInputToolbarRegistry,
|
|
11
12
|
ISelectionWatcher
|
|
12
13
|
} from '@jupyter/chat';
|
|
13
14
|
import { IThemeManager } from '@jupyterlab/apputils';
|
|
@@ -21,7 +22,11 @@ import { ISignal, Signal } from '@lumino/signaling';
|
|
|
21
22
|
import { LabChatModel } from './model';
|
|
22
23
|
import { LabChatPanel } from './widget';
|
|
23
24
|
import { YChat } from './ychat';
|
|
24
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
IInputToolbarRegistryFactory,
|
|
27
|
+
ILabChatConfig,
|
|
28
|
+
IWidgetConfig
|
|
29
|
+
} from './token';
|
|
25
30
|
|
|
26
31
|
/**
|
|
27
32
|
* The object provided by the chatDocument extension.
|
|
@@ -76,9 +81,11 @@ export class ChatWidgetFactory extends ABCWidgetFactory<
|
|
|
76
81
|
super(options);
|
|
77
82
|
this._themeManager = options.themeManager;
|
|
78
83
|
this._rmRegistry = options.rmRegistry;
|
|
79
|
-
this._documentManager = options.documentManager;
|
|
80
84
|
this._chatCommandRegistry = options.chatCommandRegistry;
|
|
81
85
|
this._attachmentOpenerRegistry = options.attachmentOpenerRegistry;
|
|
86
|
+
if (options.inputToolbarFactory) {
|
|
87
|
+
this._inputToolbarRegistry = options.inputToolbarFactory.create();
|
|
88
|
+
}
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
/**
|
|
@@ -90,9 +97,9 @@ export class ChatWidgetFactory extends ABCWidgetFactory<
|
|
|
90
97
|
protected createNewWidget(context: ChatWidgetFactory.IContext): LabChatPanel {
|
|
91
98
|
context.rmRegistry = this._rmRegistry;
|
|
92
99
|
context.themeManager = this._themeManager;
|
|
93
|
-
context.documentManager = this._documentManager;
|
|
94
100
|
context.chatCommandRegistry = this._chatCommandRegistry;
|
|
95
101
|
context.attachmentOpenerRegistry = this._attachmentOpenerRegistry;
|
|
102
|
+
context.inputToolbarRegistry = this._inputToolbarRegistry;
|
|
96
103
|
return new LabChatPanel({
|
|
97
104
|
context,
|
|
98
105
|
content: new ChatWidget(context)
|
|
@@ -101,9 +108,9 @@ export class ChatWidgetFactory extends ABCWidgetFactory<
|
|
|
101
108
|
|
|
102
109
|
private _themeManager: IThemeManager | null;
|
|
103
110
|
private _rmRegistry: IRenderMimeRegistry;
|
|
104
|
-
private _documentManager?: IDocumentManager;
|
|
105
111
|
private _chatCommandRegistry?: IChatCommandRegistry;
|
|
106
112
|
private _attachmentOpenerRegistry?: IAttachmentOpenerRegistry;
|
|
113
|
+
private _inputToolbarRegistry?: IInputToolbarRegistry;
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
export namespace ChatWidgetFactory {
|
|
@@ -113,15 +120,16 @@ export namespace ChatWidgetFactory {
|
|
|
113
120
|
documentManager?: IDocumentManager;
|
|
114
121
|
chatCommandRegistry?: IChatCommandRegistry;
|
|
115
122
|
attachmentOpenerRegistry?: IAttachmentOpenerRegistry;
|
|
123
|
+
inputToolbarRegistry?: IInputToolbarRegistry;
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
export interface IOptions<T extends LabChatPanel>
|
|
119
127
|
extends DocumentRegistry.IWidgetFactoryOptions<T> {
|
|
120
128
|
themeManager: IThemeManager | null;
|
|
121
129
|
rmRegistry: IRenderMimeRegistry;
|
|
122
|
-
documentManager?: IDocumentManager;
|
|
123
130
|
chatCommandRegistry?: IChatCommandRegistry;
|
|
124
131
|
attachmentOpenerRegistry?: IAttachmentOpenerRegistry;
|
|
132
|
+
inputToolbarFactory?: IInputToolbarRegistryFactory;
|
|
125
133
|
}
|
|
126
134
|
}
|
|
127
135
|
|
|
@@ -134,6 +142,7 @@ export class LabChatModelFactory
|
|
|
134
142
|
this._commands = options.commands;
|
|
135
143
|
this._activeCellManager = options.activeCellManager ?? null;
|
|
136
144
|
this._selectionWatcher = options.selectionWatcher ?? null;
|
|
145
|
+
this._documentManager = options.documentManager ?? null;
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
collaborative = true;
|
|
@@ -206,7 +215,8 @@ export class LabChatModelFactory
|
|
|
206
215
|
widgetConfig: this._widgetConfig,
|
|
207
216
|
commands: this._commands,
|
|
208
217
|
activeCellManager: this._activeCellManager,
|
|
209
|
-
selectionWatcher: this._selectionWatcher
|
|
218
|
+
selectionWatcher: this._selectionWatcher,
|
|
219
|
+
documentManager: this._documentManager
|
|
210
220
|
});
|
|
211
221
|
}
|
|
212
222
|
|
|
@@ -216,4 +226,5 @@ export class LabChatModelFactory
|
|
|
216
226
|
private _commands?: CommandRegistry;
|
|
217
227
|
private _activeCellManager: IActiveCellManager | null;
|
|
218
228
|
private _selectionWatcher: ISelectionWatcher | null;
|
|
229
|
+
private _documentManager: IDocumentManager | null;
|
|
219
230
|
}
|
package/src/model.ts
CHANGED
|
@@ -173,6 +173,13 @@ export class LabChatModel extends ChatModel implements DocumentRegistry.IModel {
|
|
|
173
173
|
this.sharedModel.addMessage(msg);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Override the clear messages method.
|
|
178
|
+
*/
|
|
179
|
+
clearMessages(): void {
|
|
180
|
+
// No-op as we may not need to clear the messages in file based chat.
|
|
181
|
+
}
|
|
182
|
+
|
|
176
183
|
updateMessage(
|
|
177
184
|
id: string,
|
|
178
185
|
updatedMessage: IChatMessage
|
package/src/token.ts
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
chatIcon,
|
|
9
9
|
IActiveCellManager,
|
|
10
10
|
ISelectionWatcher,
|
|
11
|
-
ChatWidget
|
|
11
|
+
ChatWidget,
|
|
12
|
+
IInputToolbarRegistry
|
|
12
13
|
} from '@jupyter/chat';
|
|
13
14
|
import { WidgetTracker } from '@jupyterlab/apputils';
|
|
14
15
|
import { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
@@ -125,3 +126,21 @@ export const IActiveCellManagerToken = new Token<IActiveCellManager>(
|
|
|
125
126
|
export const ISelectionWatcherToken = new Token<ISelectionWatcher>(
|
|
126
127
|
'jupyterlab-chat:ISelectionWatcher'
|
|
127
128
|
);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The input toolbar registry factory.
|
|
132
|
+
*/
|
|
133
|
+
export interface IInputToolbarRegistryFactory {
|
|
134
|
+
/**
|
|
135
|
+
* Create an input toolbar registry.
|
|
136
|
+
*/
|
|
137
|
+
create: () => IInputToolbarRegistry;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The token of the factory to create an input toolbar registry.
|
|
142
|
+
*/
|
|
143
|
+
export const IInputToolbarRegistryFactory =
|
|
144
|
+
new Token<IInputToolbarRegistryFactory>(
|
|
145
|
+
'jupyterlab-chat:IInputToolbarRegistryFactory'
|
|
146
|
+
);
|
package/src/widget.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
IAttachmentOpenerRegistry,
|
|
9
9
|
IChatCommandRegistry,
|
|
10
10
|
IChatModel,
|
|
11
|
+
IInputToolbarRegistry,
|
|
11
12
|
readIcon
|
|
12
13
|
} from '@jupyter/chat';
|
|
13
14
|
import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
|
|
@@ -33,8 +34,11 @@ import { AccordionPanel, Panel } from '@lumino/widgets';
|
|
|
33
34
|
import React, { useState } from 'react';
|
|
34
35
|
|
|
35
36
|
import { LabChatModel } from './model';
|
|
36
|
-
import {
|
|
37
|
-
|
|
37
|
+
import {
|
|
38
|
+
CommandIDs,
|
|
39
|
+
IInputToolbarRegistryFactory,
|
|
40
|
+
chatFileType
|
|
41
|
+
} from './token';
|
|
38
42
|
|
|
39
43
|
const MAIN_PANEL_CLASS = 'jp-lab-chat-main-panel';
|
|
40
44
|
const TITLE_UNREAD_CLASS = 'jp-lab-chat-title-unread';
|
|
@@ -104,9 +108,9 @@ export class ChatPanel extends SidePanel {
|
|
|
104
108
|
this._rmRegistry = options.rmRegistry;
|
|
105
109
|
this._themeManager = options.themeManager;
|
|
106
110
|
this._defaultDirectory = options.defaultDirectory;
|
|
107
|
-
this._documentManager = options.documentManager;
|
|
108
111
|
this._chatCommandRegistry = options.chatCommandRegistry;
|
|
109
112
|
this._attachmentOpenerRegistry = options.attachmentOpenerRegistry;
|
|
113
|
+
this._inputToolbarFactory = options.inputToolbarFactory;
|
|
110
114
|
|
|
111
115
|
const addChat = new CommandToolbarButton({
|
|
112
116
|
commands: this._commands,
|
|
@@ -163,14 +167,20 @@ export class ChatPanel extends SidePanel {
|
|
|
163
167
|
content.collapse(i);
|
|
164
168
|
}
|
|
165
169
|
|
|
170
|
+
// Create the toolbar registry.
|
|
171
|
+
let inputToolbarRegistry: IInputToolbarRegistry | undefined;
|
|
172
|
+
if (this._inputToolbarFactory) {
|
|
173
|
+
inputToolbarRegistry = this._inputToolbarFactory.create();
|
|
174
|
+
}
|
|
175
|
+
|
|
166
176
|
// Create a new widget.
|
|
167
177
|
const widget = new ChatWidget({
|
|
168
178
|
model: model,
|
|
169
179
|
rmRegistry: this._rmRegistry,
|
|
170
180
|
themeManager: this._themeManager,
|
|
171
|
-
documentManager: this._documentManager,
|
|
172
181
|
chatCommandRegistry: this._chatCommandRegistry,
|
|
173
|
-
attachmentOpenerRegistry: this._attachmentOpenerRegistry
|
|
182
|
+
attachmentOpenerRegistry: this._attachmentOpenerRegistry,
|
|
183
|
+
inputToolbarRegistry
|
|
174
184
|
});
|
|
175
185
|
|
|
176
186
|
this.addWidget(
|
|
@@ -289,9 +299,9 @@ export class ChatPanel extends SidePanel {
|
|
|
289
299
|
private _openChat: ReactWidget;
|
|
290
300
|
private _rmRegistry: IRenderMimeRegistry;
|
|
291
301
|
private _themeManager: IThemeManager | null;
|
|
292
|
-
private _documentManager?: IDocumentManager;
|
|
293
302
|
private _chatCommandRegistry?: IChatCommandRegistry;
|
|
294
303
|
private _attachmentOpenerRegistry?: IAttachmentOpenerRegistry;
|
|
304
|
+
private _inputToolbarFactory?: IInputToolbarRegistryFactory;
|
|
295
305
|
}
|
|
296
306
|
|
|
297
307
|
/**
|
|
@@ -307,9 +317,9 @@ export namespace ChatPanel {
|
|
|
307
317
|
rmRegistry: IRenderMimeRegistry;
|
|
308
318
|
themeManager: IThemeManager | null;
|
|
309
319
|
defaultDirectory: string;
|
|
310
|
-
documentManager?: IDocumentManager;
|
|
311
320
|
chatCommandRegistry?: IChatCommandRegistry;
|
|
312
321
|
attachmentOpenerRegistry?: IAttachmentOpenerRegistry;
|
|
322
|
+
inputToolbarFactory?: IInputToolbarRegistryFactory;
|
|
313
323
|
}
|
|
314
324
|
}
|
|
315
325
|
|
package/style/base.css
CHANGED