jupyter-chat-example 0.9.0 → 0.10.1
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/index.js +10 -2
- package/package.json +2 -2
- package/src/index.ts +15 -3
package/lib/index.js
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
* Copyright (c) Jupyter Development Team.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { ActiveCellManager, AttachmentOpenerRegistry, buildChatSidebar,
|
|
5
|
+
import { ActiveCellManager, AttachmentOpenerRegistry, buildChatSidebar, AbstractChatModel, SelectionWatcher, AbstractChatContext } from '@jupyter/chat';
|
|
6
6
|
import { IThemeManager } from '@jupyterlab/apputils';
|
|
7
7
|
import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';
|
|
8
8
|
import { INotebookTracker } from '@jupyterlab/notebook';
|
|
9
9
|
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
10
10
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
11
11
|
import { UUID } from '@lumino/coreutils';
|
|
12
|
-
class
|
|
12
|
+
class ChatContext extends AbstractChatContext {
|
|
13
|
+
get users() {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class MyChatModel extends AbstractChatModel {
|
|
13
18
|
sendMessage(newMessage) {
|
|
14
19
|
var _a;
|
|
15
20
|
const message = {
|
|
@@ -23,6 +28,9 @@ class MyChatModel extends ChatModel {
|
|
|
23
28
|
this.messageAdded(message);
|
|
24
29
|
this.input.clearAttachments();
|
|
25
30
|
}
|
|
31
|
+
createChatContext() {
|
|
32
|
+
return new ChatContext({ model: this });
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
35
|
/*
|
|
28
36
|
* Extension providing a chat panel.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyter-chat-example",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "A chat extension providing a chat as example",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"install:extension": "jlpm build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@jupyter/chat": "^0.
|
|
47
|
+
"@jupyter/chat": "^0.10.1",
|
|
48
48
|
"@jupyterlab/application": "^4.2.0",
|
|
49
49
|
"@jupyterlab/apputils": "^4.3.0",
|
|
50
50
|
"@jupyterlab/notebook": "^4.2.0",
|
package/src/index.ts
CHANGED
|
@@ -7,11 +7,13 @@ import {
|
|
|
7
7
|
ActiveCellManager,
|
|
8
8
|
AttachmentOpenerRegistry,
|
|
9
9
|
buildChatSidebar,
|
|
10
|
-
|
|
10
|
+
AbstractChatModel,
|
|
11
11
|
IAttachment,
|
|
12
12
|
IChatMessage,
|
|
13
13
|
INewMessage,
|
|
14
|
-
SelectionWatcher
|
|
14
|
+
SelectionWatcher,
|
|
15
|
+
IChatContext,
|
|
16
|
+
AbstractChatContext
|
|
15
17
|
} from '@jupyter/chat';
|
|
16
18
|
import {
|
|
17
19
|
JupyterFrontEnd,
|
|
@@ -24,7 +26,13 @@ import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
|
24
26
|
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
25
27
|
import { UUID } from '@lumino/coreutils';
|
|
26
28
|
|
|
27
|
-
class
|
|
29
|
+
class ChatContext extends AbstractChatContext {
|
|
30
|
+
get users() {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
class MyChatModel extends AbstractChatModel {
|
|
28
36
|
sendMessage(
|
|
29
37
|
newMessage: INewMessage
|
|
30
38
|
): Promise<boolean | void> | boolean | void {
|
|
@@ -39,6 +47,10 @@ class MyChatModel extends ChatModel {
|
|
|
39
47
|
this.messageAdded(message);
|
|
40
48
|
this.input.clearAttachments();
|
|
41
49
|
}
|
|
50
|
+
|
|
51
|
+
createChatContext(): IChatContext {
|
|
52
|
+
return new ChatContext({ model: this });
|
|
53
|
+
}
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
/*
|