jupyterlab-chat-extension 0.23.0 → 0.23.2
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 +9 -5
- package/package.json +18 -18
- package/src/index.ts +15 -5
package/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
|
17
17
|
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
18
18
|
import { launchIcon } from '@jupyterlab/ui-components';
|
|
19
19
|
import { PromiseDelegate } from '@lumino/coreutils';
|
|
20
|
-
import { ChatWidgetFactory, CommandIDs, IActiveCellManagerToken, IChatFactory, IChatToolbarFactory, IMultiChatPanel, ISelectionWatcherToken, IWelcomeMessage, IWidgetConfig, LabChatModelFactory, LabChatPanel, WidgetConfig, YChat, chatFileType, getDisplayName } from 'jupyterlab-chat';
|
|
20
|
+
import { ChatWidgetFactory, CommandIDs, IActiveCellManagerToken, IChatFactory, IChatToolbarFactory, IMultiChatPanel, ISelectionWatcherToken, IWelcomeMessage, IWidgetConfig, LabChatModelFactory, LabChatPanel, WidgetConfig, YChat, chatFileType, getDisplayName, resolveChatRenamePath } from 'jupyterlab-chat';
|
|
21
21
|
import { chatCommandRegistryPlugin } from './chat-commands/plugins';
|
|
22
22
|
import { emojiCommandsPlugin } from './chat-commands/providers/emoji';
|
|
23
23
|
import { mentionCommandsPlugin } from './chat-commands/providers/user-mention';
|
|
@@ -68,6 +68,12 @@ async function createChatModel(app, contentProvider, path, defaultDirectory) {
|
|
|
68
68
|
});
|
|
69
69
|
// Set the name of the model.
|
|
70
70
|
chatModel.name = model.path;
|
|
71
|
+
// Chats opened in the side panel have no document context, so the provider
|
|
72
|
+
// created above is what tells us when the document has been loaded. Without
|
|
73
|
+
// this the chat would only become usable when the document first becomes
|
|
74
|
+
// clean, which can be a second later (or never).
|
|
75
|
+
const provider = contentProvider.providers.get(`${model.format}:${chatFileType.contentType}:${model.path}`);
|
|
76
|
+
provider === null || provider === void 0 ? void 0 : provider.ready.then(() => chatModel.markDocumentSynced()).catch(e => console.error('The chat document failed to load', e));
|
|
71
77
|
return {
|
|
72
78
|
model: chatModel,
|
|
73
79
|
displayName: getDisplayName(model.path, defaultDirectory)
|
|
@@ -873,10 +879,8 @@ const chatCommands = {
|
|
|
873
879
|
if (!newPath) {
|
|
874
880
|
return null;
|
|
875
881
|
}
|
|
876
|
-
// Ensure `.chat` extension
|
|
877
|
-
|
|
878
|
-
newPath = `${newPath}${chatFileType.extensions[0]}`;
|
|
879
|
-
}
|
|
882
|
+
// Ensure `.chat` extension and keep the chat in its current directory.
|
|
883
|
+
newPath = resolveChatRenamePath(oldPath, newPath);
|
|
880
884
|
try {
|
|
881
885
|
await app.serviceManager.contents.rename(oldPath, newPath);
|
|
882
886
|
return getDisplayName(newPath, widgetConfig.config.defaultDirectory);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyterlab-chat-extension",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
4
4
|
"description": "A chat extension based on shared documents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -47,33 +47,33 @@
|
|
|
47
47
|
"watch:labextension": "jupyter-builder watch ."
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@jupyter-notebook/application": "^7.
|
|
51
|
-
"@jupyter/collaborative-drive": "^4.4.0 || ^5.0.0
|
|
50
|
+
"@jupyter-notebook/application": "^7.5.0",
|
|
51
|
+
"@jupyter/collaborative-drive": "^4.4.0 || ^5.0.0",
|
|
52
52
|
"@jupyter/ydoc": "^3.0.0 || ^4.0.0",
|
|
53
|
-
"@jupyterlab/application": "^4.
|
|
54
|
-
"@jupyterlab/apputils": "^4.
|
|
55
|
-
"@jupyterlab/codemirror": "^4.
|
|
56
|
-
"@jupyterlab/coreutils": "^6.
|
|
57
|
-
"@jupyterlab/docregistry": "^4.
|
|
58
|
-
"@jupyterlab/filebrowser": "^4.
|
|
59
|
-
"@jupyterlab/launcher": "^4.
|
|
60
|
-
"@jupyterlab/notebook": "^4.
|
|
61
|
-
"@jupyterlab/rendermime": "^4.
|
|
62
|
-
"@jupyterlab/services": "^7.
|
|
63
|
-
"@jupyterlab/settingregistry": "^4.
|
|
64
|
-
"@jupyterlab/translation": "^4.
|
|
65
|
-
"@jupyterlab/ui-components": "^4.
|
|
53
|
+
"@jupyterlab/application": "^4.5.0",
|
|
54
|
+
"@jupyterlab/apputils": "^4.6.0",
|
|
55
|
+
"@jupyterlab/codemirror": "^4.5.0",
|
|
56
|
+
"@jupyterlab/coreutils": "^6.5.0",
|
|
57
|
+
"@jupyterlab/docregistry": "^4.5.0",
|
|
58
|
+
"@jupyterlab/filebrowser": "^4.5.0",
|
|
59
|
+
"@jupyterlab/launcher": "^4.5.0",
|
|
60
|
+
"@jupyterlab/notebook": "^4.5.0",
|
|
61
|
+
"@jupyterlab/rendermime": "^4.5.0",
|
|
62
|
+
"@jupyterlab/services": "^7.5.0",
|
|
63
|
+
"@jupyterlab/settingregistry": "^4.5.0",
|
|
64
|
+
"@jupyterlab/translation": "^4.5.0",
|
|
65
|
+
"@jupyterlab/ui-components": "^4.5.0",
|
|
66
66
|
"@lumino/commands": "^2.3.3",
|
|
67
67
|
"@lumino/coreutils": "^2.2.2",
|
|
68
68
|
"@lumino/signaling": "^2.1.5",
|
|
69
69
|
"@lumino/widgets": "^2.8.0",
|
|
70
|
-
"jupyterlab-chat": "^0.23.
|
|
70
|
+
"jupyterlab-chat": "^0.23.2",
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"y-protocols": "^1.0.5",
|
|
73
73
|
"yjs": "^13.5.40"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@jupyter/builder": "^1.0
|
|
76
|
+
"@jupyter/builder": "^1.2.0",
|
|
77
77
|
"@types/json-schema": "^7.0.11",
|
|
78
78
|
"@types/react": "^18.2.0",
|
|
79
79
|
"@types/react-addons-linked-state-mixin": "^0.14.22",
|
package/src/index.ts
CHANGED
|
@@ -72,7 +72,8 @@ import {
|
|
|
72
72
|
WidgetConfig,
|
|
73
73
|
YChat,
|
|
74
74
|
chatFileType,
|
|
75
|
-
getDisplayName
|
|
75
|
+
getDisplayName,
|
|
76
|
+
resolveChatRenamePath
|
|
76
77
|
} from 'jupyterlab-chat';
|
|
77
78
|
import { chatCommandRegistryPlugin } from './chat-commands/plugins';
|
|
78
79
|
import { emojiCommandsPlugin } from './chat-commands/providers/emoji';
|
|
@@ -140,6 +141,17 @@ async function createChatModel(
|
|
|
140
141
|
// Set the name of the model.
|
|
141
142
|
chatModel.name = model.path;
|
|
142
143
|
|
|
144
|
+
// Chats opened in the side panel have no document context, so the provider
|
|
145
|
+
// created above is what tells us when the document has been loaded. Without
|
|
146
|
+
// this the chat would only become usable when the document first becomes
|
|
147
|
+
// clean, which can be a second later (or never).
|
|
148
|
+
const provider = contentProvider.providers.get(
|
|
149
|
+
`${model.format}:${chatFileType.contentType}:${model.path}`
|
|
150
|
+
);
|
|
151
|
+
provider?.ready
|
|
152
|
+
.then(() => chatModel.markDocumentSynced())
|
|
153
|
+
.catch(e => console.error('The chat document failed to load', e));
|
|
154
|
+
|
|
143
155
|
return {
|
|
144
156
|
model: chatModel,
|
|
145
157
|
displayName: getDisplayName(model.path, defaultDirectory)
|
|
@@ -1106,10 +1118,8 @@ const chatCommands: JupyterFrontEndPlugin<void> = {
|
|
|
1106
1118
|
return null;
|
|
1107
1119
|
}
|
|
1108
1120
|
|
|
1109
|
-
// Ensure `.chat` extension
|
|
1110
|
-
|
|
1111
|
-
newPath = `${newPath}${chatFileType.extensions[0]}`;
|
|
1112
|
-
}
|
|
1121
|
+
// Ensure `.chat` extension and keep the chat in its current directory.
|
|
1122
|
+
newPath = resolveChatRenamePath(oldPath, newPath);
|
|
1113
1123
|
|
|
1114
1124
|
try {
|
|
1115
1125
|
await app.serviceManager.contents.rename(oldPath, newPath);
|