@jupyter/chat 0.20.0-alpha.2 → 0.20.0-alpha.3
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/widgets/chat-selector-popup.d.ts +102 -0
- package/lib/widgets/chat-selector-popup.js +293 -0
- package/lib/widgets/chat-widget.js +1 -0
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +1 -0
- package/lib/widgets/multichat-panel.d.ts +100 -73
- package/lib/widgets/multichat-panel.js +356 -159
- package/package.json +1 -1
- package/src/widgets/chat-selector-popup.tsx +440 -0
- package/src/widgets/chat-widget.tsx +1 -0
- package/src/widgets/index.ts +1 -0
- package/src/widgets/multichat-panel.tsx +434 -207
- package/style/base.css +1 -0
- package/style/chat-selector.css +161 -0
- package/style/chat.css +34 -2
|
@@ -1,69 +1,92 @@
|
|
|
1
|
-
import { PanelWithToolbar
|
|
1
|
+
import { PanelWithToolbar } from '@jupyterlab/ui-components';
|
|
2
|
+
import { Message } from '@lumino/messaging';
|
|
2
3
|
import { ISignal } from '@lumino/signaling';
|
|
3
|
-
import { Panel } from '@lumino/widgets';
|
|
4
4
|
import { ChatWidget } from './chat-widget';
|
|
5
5
|
import { Chat, IInputToolbarRegistryFactory } from '../components';
|
|
6
6
|
import { IChatModel } from '../model';
|
|
7
7
|
/**
|
|
8
8
|
* Generic sidepanel widget including multiple chats and the add chat button.
|
|
9
9
|
*/
|
|
10
|
-
export declare class MultiChatPanel extends
|
|
10
|
+
export declare class MultiChatPanel extends PanelWithToolbar {
|
|
11
|
+
/**
|
|
12
|
+
* The constructor of the multichat panel.
|
|
13
|
+
*/
|
|
11
14
|
constructor(options: MultiChatPanel.IOptions);
|
|
12
15
|
/**
|
|
13
|
-
* The
|
|
16
|
+
* The currently displayed chat widget.
|
|
14
17
|
*/
|
|
15
|
-
get
|
|
18
|
+
get current(): SidePanelWidget | undefined;
|
|
16
19
|
/**
|
|
17
|
-
* A signal emitting when a
|
|
20
|
+
* A signal emitting when a chat widget is opened in the panel.
|
|
18
21
|
*/
|
|
19
|
-
get
|
|
22
|
+
get chatOpened(): ISignal<MultiChatPanel, ChatWidget>;
|
|
20
23
|
/**
|
|
21
|
-
*
|
|
24
|
+
* A signal emitting when the panel visibility changed.
|
|
25
|
+
*/
|
|
26
|
+
get visibilityChanged(): ISignal<MultiChatPanel, boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Add a chat to the panel by creating or showing its widget.
|
|
22
29
|
*
|
|
23
|
-
* @param
|
|
24
|
-
|
|
30
|
+
* @param args - the chat args including model and display name.
|
|
31
|
+
*/
|
|
32
|
+
open(args: MultiChatPanel.IOpenChatArgs): ChatWidget | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Get a loaded model by name, or undefined if not loaded.
|
|
35
|
+
*/
|
|
36
|
+
getLoadedModel(name: string): IChatModel | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Get all loaded model names.
|
|
39
|
+
*/
|
|
40
|
+
getLoadedModelNames(): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Dispose a model, removing it from loaded models.
|
|
25
43
|
*/
|
|
26
|
-
|
|
44
|
+
disposeLoadedModel(name: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Emit a signal when the panel visibility changed.
|
|
47
|
+
*/
|
|
48
|
+
protected onAfterShow(msg: Message): void;
|
|
49
|
+
protected onBeforeHide(msg: Message): void;
|
|
50
|
+
/**
|
|
51
|
+
* Open a specific chat by name, creating a new sidepanel widget.
|
|
52
|
+
*/
|
|
53
|
+
private _open;
|
|
27
54
|
/**
|
|
28
55
|
* Invoke the update of the list of available chats.
|
|
29
56
|
*/
|
|
30
|
-
updateChatList()
|
|
57
|
+
updateChatList: () => void;
|
|
31
58
|
/**
|
|
32
59
|
* Update the list of available chats.
|
|
33
60
|
*/
|
|
34
61
|
private _updateChatList;
|
|
35
62
|
/**
|
|
36
|
-
* Open a chat if
|
|
63
|
+
* Open a chat if its model is already loaded.
|
|
37
64
|
*
|
|
38
65
|
* @param name - the name of the chat.
|
|
39
|
-
* @returns a boolean, whether the chat
|
|
66
|
+
* @returns a boolean, whether the chat model was already loaded or not.
|
|
40
67
|
*/
|
|
41
|
-
|
|
68
|
+
openIfLoaded(name: string): boolean;
|
|
42
69
|
/**
|
|
43
70
|
* A message handler invoked on an `'after-attach'` message.
|
|
44
71
|
*/
|
|
45
72
|
protected onAfterAttach(): void;
|
|
46
73
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @param name - the chat name.
|
|
74
|
+
* A message handler invoked on an `'before-detach'` message.
|
|
50
75
|
*/
|
|
51
|
-
|
|
76
|
+
protected onBeforeDetach(): void;
|
|
52
77
|
/**
|
|
53
|
-
*
|
|
78
|
+
* Dispose of the resources held by the widget.
|
|
54
79
|
*/
|
|
55
|
-
|
|
80
|
+
dispose(): void;
|
|
56
81
|
/**
|
|
57
|
-
*
|
|
82
|
+
* Update loaded model when the current widget updates its name.
|
|
58
83
|
*/
|
|
59
|
-
private
|
|
84
|
+
private _modelNameChanged;
|
|
60
85
|
/**
|
|
61
|
-
*
|
|
62
|
-
* sections are closed.
|
|
86
|
+
* Handle chat selection from the popup.
|
|
63
87
|
*/
|
|
64
|
-
private
|
|
65
|
-
private
|
|
66
|
-
private _sectionAdded;
|
|
88
|
+
private _onSelectChat;
|
|
89
|
+
private _chatOpened;
|
|
67
90
|
private _chatOptions;
|
|
68
91
|
private _inputToolbarFactory?;
|
|
69
92
|
private _updateChatListDebouncer;
|
|
@@ -72,6 +95,11 @@ export declare class MultiChatPanel extends SidePanel {
|
|
|
72
95
|
private _openInMain?;
|
|
73
96
|
private _renameChat?;
|
|
74
97
|
private _openChatWidget?;
|
|
98
|
+
private _chatSelectorPopup?;
|
|
99
|
+
private _loadedModels;
|
|
100
|
+
private _currentWidget?;
|
|
101
|
+
private _chatNames;
|
|
102
|
+
private _visibilityChanged;
|
|
75
103
|
}
|
|
76
104
|
/**
|
|
77
105
|
* The chat panel namespace.
|
|
@@ -80,7 +108,7 @@ export declare namespace MultiChatPanel {
|
|
|
80
108
|
/**
|
|
81
109
|
* Options of the constructor of the chat panel.
|
|
82
110
|
*/
|
|
83
|
-
interface IOptions extends
|
|
111
|
+
interface IOptions extends PanelWithToolbar.IOptions, Omit<Chat.IOptions, 'model' | 'inputToolbarRegistry'> {
|
|
84
112
|
/**
|
|
85
113
|
* The input toolbar factory;
|
|
86
114
|
*/
|
|
@@ -89,13 +117,13 @@ export declare namespace MultiChatPanel {
|
|
|
89
117
|
* An optional callback to create a chat model.
|
|
90
118
|
*
|
|
91
119
|
* @param name - the name of the chat, optional.
|
|
92
|
-
* @return an object that can be passed to
|
|
120
|
+
* @return an object that can be passed to open the chat.
|
|
93
121
|
*/
|
|
94
|
-
createModel?: (name?: string) => Promise<
|
|
122
|
+
createModel?: (name?: string) => Promise<IOpenChatArgs>;
|
|
95
123
|
/**
|
|
96
124
|
* An optional callback to get the list of existing chats.
|
|
97
125
|
*
|
|
98
|
-
* @returns an object
|
|
126
|
+
* @returns an object mapping chat display names to identifiers.
|
|
99
127
|
*/
|
|
100
128
|
getChatNames?: () => Promise<{
|
|
101
129
|
[name: string]: string;
|
|
@@ -113,95 +141,94 @@ export declare namespace MultiChatPanel {
|
|
|
113
141
|
* @param newName - the new name of the chat.
|
|
114
142
|
* @returns - a boolean, whether the chat has been renamed or not.
|
|
115
143
|
*/
|
|
116
|
-
renameChat?: (oldName: string
|
|
144
|
+
renameChat?: boolean | ((oldName: string) => Promise<string | null>);
|
|
117
145
|
}
|
|
118
146
|
/**
|
|
119
147
|
* The options for the add chat method.
|
|
120
148
|
*/
|
|
121
|
-
interface
|
|
149
|
+
interface IOpenChatArgs {
|
|
122
150
|
/**
|
|
123
151
|
* The model of the chat.
|
|
124
|
-
* No-op
|
|
152
|
+
* No-op if undefined.
|
|
125
153
|
*/
|
|
126
154
|
model?: IChatModel;
|
|
127
155
|
/**
|
|
128
|
-
* The display name of the chat in the
|
|
156
|
+
* The display name of the chat, shown in the toolbar.
|
|
129
157
|
*/
|
|
130
158
|
displayName?: string;
|
|
131
159
|
}
|
|
132
160
|
}
|
|
133
161
|
/**
|
|
134
|
-
*
|
|
162
|
+
* A widget containing the chat and its toolbar.
|
|
135
163
|
*/
|
|
136
|
-
|
|
164
|
+
declare class SidePanelWidget extends PanelWithToolbar {
|
|
165
|
+
constructor(options: SidePanelWidget.IOptions);
|
|
137
166
|
/**
|
|
138
|
-
*
|
|
167
|
+
* The chat widget embedded in the sidepanel widget.
|
|
139
168
|
*/
|
|
140
|
-
|
|
169
|
+
get widget(): ChatWidget;
|
|
141
170
|
/**
|
|
142
|
-
* The
|
|
171
|
+
* The model of the widget.
|
|
143
172
|
*/
|
|
144
|
-
get
|
|
145
|
-
set displayName(value: string);
|
|
173
|
+
get model(): IChatModel;
|
|
146
174
|
/**
|
|
147
|
-
* The
|
|
175
|
+
* The displayed name of the widget.
|
|
148
176
|
*/
|
|
149
|
-
get
|
|
177
|
+
get name(): string;
|
|
178
|
+
set name(value: string);
|
|
150
179
|
/**
|
|
151
|
-
*
|
|
180
|
+
* A signal emitting when the name has changed.
|
|
152
181
|
*/
|
|
153
|
-
get
|
|
182
|
+
get nameChanged(): ISignal<SidePanelWidget, {
|
|
183
|
+
old: string;
|
|
184
|
+
new: string;
|
|
185
|
+
}>;
|
|
154
186
|
/**
|
|
155
187
|
* Dispose of the resources held by the widget.
|
|
156
188
|
*/
|
|
157
189
|
dispose(): void;
|
|
158
190
|
/**
|
|
159
|
-
*
|
|
160
|
-
|
|
191
|
+
* Update the title based on the chat name.
|
|
192
|
+
*/
|
|
161
193
|
private _updateTitle;
|
|
162
194
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* TODO: fix it upstream in @jupyterlab/ui-components.
|
|
166
|
-
* Updating the title create a new Title widget, but does not attach again the
|
|
167
|
-
* toolbar. The toolbar is attached only when the title widget is attached the first
|
|
168
|
-
* time.
|
|
195
|
+
* Enable/disable unread icon.
|
|
169
196
|
*/
|
|
170
197
|
private _unreadChanged;
|
|
171
198
|
private _chatWidget;
|
|
172
199
|
private _markAsRead;
|
|
173
|
-
private _spinner;
|
|
174
200
|
private _displayName;
|
|
201
|
+
private _titleWidget;
|
|
202
|
+
private _nameChanged;
|
|
175
203
|
}
|
|
176
204
|
/**
|
|
177
|
-
* The
|
|
205
|
+
* The sidepanel widget namespace.
|
|
178
206
|
*/
|
|
179
|
-
|
|
207
|
+
declare namespace SidePanelWidget {
|
|
180
208
|
/**
|
|
181
|
-
*
|
|
209
|
+
* The sidepanel widget constructor options.
|
|
182
210
|
*/
|
|
183
|
-
interface IOptions
|
|
211
|
+
interface IOptions {
|
|
184
212
|
/**
|
|
185
|
-
* The widget
|
|
213
|
+
* The chat widget.
|
|
186
214
|
*/
|
|
187
215
|
widget: ChatWidget;
|
|
188
216
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* @param name - the name of the chat to move.
|
|
217
|
+
* The callback when closing the chat.
|
|
192
218
|
*/
|
|
193
|
-
|
|
219
|
+
onClose: (name: string) => void;
|
|
194
220
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* @param oldName - the old name of the chat.
|
|
198
|
-
* @param newName - the new name of the chat.
|
|
199
|
-
* @returns - a boolean, whether the chat has been renamed or not.
|
|
221
|
+
* The displayed name of the chat.
|
|
200
222
|
*/
|
|
201
|
-
|
|
223
|
+
displayName?: string;
|
|
202
224
|
/**
|
|
203
|
-
* The
|
|
225
|
+
* The callback to open the chat in main area.
|
|
204
226
|
*/
|
|
205
|
-
|
|
227
|
+
openInMain?: (name: string) => Promise<boolean>;
|
|
228
|
+
/**
|
|
229
|
+
* The callback to rename the chat.
|
|
230
|
+
*/
|
|
231
|
+
renameChat?: boolean | ((oldName: string) => Promise<string | null>);
|
|
206
232
|
}
|
|
207
233
|
}
|
|
234
|
+
export {};
|