jupyterlab-chat 0.20.0 → 0.21.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 +1 -1
- package/lib/model.js +7 -9
- package/lib/token.d.ts +4 -0
- package/lib/token.js +5 -1
- package/package.json +2 -2
- package/src/factory.ts +1 -1
- package/src/model.ts +10 -10
- package/src/token.ts +5 -1
package/lib/factory.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare class ChatWidgetFactory extends ABCWidgetFactory<LabChatPanel, La
|
|
|
58
58
|
export declare namespace ChatWidgetFactory {
|
|
59
59
|
interface IContext extends DocumentRegistry.IContext<LabChatModel>, Omit<Chat.IOptions, 'model'> {
|
|
60
60
|
}
|
|
61
|
-
interface IOptions<T extends LabChatPanel> extends DocumentRegistry.IWidgetFactoryOptions<T>, Omit<Chat.IOptions, 'model' | 'inputToolbarRegistry'> {
|
|
61
|
+
interface IOptions<T extends LabChatPanel> extends DocumentRegistry.IWidgetFactoryOptions<T>, Omit<Chat.IOptions, 'model' | 'inputToolbarRegistry' | 'translator'> {
|
|
62
62
|
inputToolbarFactory: IInputToolbarRegistryFactory;
|
|
63
63
|
}
|
|
64
64
|
}
|
package/lib/model.js
CHANGED
|
@@ -118,8 +118,8 @@ export class LabChatModel extends AbstractChatModel {
|
|
|
118
118
|
const msg = {
|
|
119
119
|
...baseMessage,
|
|
120
120
|
sender: this.sharedModel.getUser(sender) || {
|
|
121
|
-
username: 'User undefined',
|
|
122
|
-
mention_name: 'User-undefined'
|
|
121
|
+
username: this._trans.__('User undefined'),
|
|
122
|
+
mention_name: this._trans.__('User-undefined')
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
// Add attachments.
|
|
@@ -136,8 +136,8 @@ export class LabChatModel extends AbstractChatModel {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
const mentions = (mentionsIds !== null && mentionsIds !== void 0 ? mentionsIds : []).map(user => this.sharedModel.getUser(user) || {
|
|
139
|
-
username: 'User undefined',
|
|
140
|
-
mention_name: 'User-undefined'
|
|
139
|
+
username: this._trans.__('User undefined'),
|
|
140
|
+
mention_name: this._trans.__('User-undefined')
|
|
141
141
|
});
|
|
142
142
|
if (mentions === null || mentions === void 0 ? void 0 : mentions.length) {
|
|
143
143
|
msg.mentions = mentions;
|
|
@@ -179,8 +179,8 @@ export class LabChatModel extends AbstractChatModel {
|
|
|
179
179
|
}
|
|
180
180
|
else if (key === 'mentions') {
|
|
181
181
|
const mentions = value.map(user => this.sharedModel.getUser(user) || {
|
|
182
|
-
username: 'User undefined',
|
|
183
|
-
mention_name: 'User-undefined'
|
|
182
|
+
username: this._trans.__('User undefined'),
|
|
183
|
+
mention_name: this._trans.__('User-undefined')
|
|
184
184
|
});
|
|
185
185
|
if (mentions === null || mentions === void 0 ? void 0 : mentions.length) {
|
|
186
186
|
message.update({ mentions });
|
|
@@ -373,9 +373,7 @@ export class LabChatModel extends AbstractChatModel {
|
|
|
373
373
|
delete message.attachments;
|
|
374
374
|
}
|
|
375
375
|
// Update the mentioned users (text messages only).
|
|
376
|
-
const mentions =
|
|
377
|
-
? this._buildMentionList(updatedMessage.mentions, updatedMessage.body)
|
|
378
|
-
: [];
|
|
376
|
+
const mentions = this._buildMentionList(updatedMessage.mentions, updatedMessage.body);
|
|
379
377
|
if (mentions.length) {
|
|
380
378
|
message.mentions = mentions;
|
|
381
379
|
}
|
package/lib/token.d.ts
CHANGED
package/lib/token.js
CHANGED
|
@@ -55,7 +55,11 @@ export const CommandIDs = {
|
|
|
55
55
|
/**
|
|
56
56
|
* Rename the current chat.
|
|
57
57
|
*/
|
|
58
|
-
renameChat: 'jupyterlab-chat:renameChat'
|
|
58
|
+
renameChat: 'jupyterlab-chat:renameChat',
|
|
59
|
+
/**
|
|
60
|
+
* Open a chat and send a message into it.
|
|
61
|
+
*/
|
|
62
|
+
openWithMessage: 'jupyterlab-chat:openWithMessage'
|
|
59
63
|
};
|
|
60
64
|
/**
|
|
61
65
|
* The chat panel token.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyterlab-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.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.21.0",
|
|
46
46
|
"@jupyter/collaborative-drive": "^4.0.2",
|
|
47
47
|
"@jupyter/ydoc": "^2.0.0 || ^3.0.0",
|
|
48
48
|
"@jupyterlab/application": "^4.2.0",
|
package/src/factory.ts
CHANGED
|
@@ -108,7 +108,7 @@ export namespace ChatWidgetFactory {
|
|
|
108
108
|
|
|
109
109
|
export interface IOptions<T extends LabChatPanel>
|
|
110
110
|
extends DocumentRegistry.IWidgetFactoryOptions<T>,
|
|
111
|
-
Omit<Chat.IOptions, 'model' | 'inputToolbarRegistry'> {
|
|
111
|
+
Omit<Chat.IOptions, 'model' | 'inputToolbarRegistry' | 'translator'> {
|
|
112
112
|
inputToolbarFactory: IInputToolbarRegistryFactory;
|
|
113
113
|
}
|
|
114
114
|
}
|
package/src/model.ts
CHANGED
|
@@ -277,10 +277,10 @@ export class LabChatModel
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// Update the mentioned users (text messages only).
|
|
280
|
-
const mentions =
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
const mentions = this._buildMentionList(
|
|
281
|
+
updatedMessage.mentions,
|
|
282
|
+
updatedMessage.body
|
|
283
|
+
);
|
|
284
284
|
if (mentions.length) {
|
|
285
285
|
message.mentions = mentions;
|
|
286
286
|
} else {
|
|
@@ -417,8 +417,8 @@ export class LabChatModel
|
|
|
417
417
|
const msg: IMessageContent = {
|
|
418
418
|
...baseMessage,
|
|
419
419
|
sender: this.sharedModel.getUser(sender) || {
|
|
420
|
-
username: 'User undefined',
|
|
421
|
-
mention_name: 'User-undefined'
|
|
420
|
+
username: this._trans.__('User undefined'),
|
|
421
|
+
mention_name: this._trans.__('User-undefined')
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
424
|
|
|
@@ -439,8 +439,8 @@ export class LabChatModel
|
|
|
439
439
|
const mentions: IUser[] = (mentionsIds ?? []).map(
|
|
440
440
|
user =>
|
|
441
441
|
this.sharedModel.getUser(user) || {
|
|
442
|
-
username: 'User undefined',
|
|
443
|
-
mention_name: 'User-undefined'
|
|
442
|
+
username: this._trans.__('User undefined'),
|
|
443
|
+
mention_name: this._trans.__('User-undefined')
|
|
444
444
|
}
|
|
445
445
|
);
|
|
446
446
|
|
|
@@ -483,8 +483,8 @@ export class LabChatModel
|
|
|
483
483
|
const mentions: IUser[] = (value as string[]).map(
|
|
484
484
|
user =>
|
|
485
485
|
this.sharedModel.getUser(user) || {
|
|
486
|
-
username: 'User undefined',
|
|
487
|
-
mention_name: 'User-undefined'
|
|
486
|
+
username: this._trans.__('User undefined'),
|
|
487
|
+
mention_name: this._trans.__('User-undefined')
|
|
488
488
|
}
|
|
489
489
|
);
|
|
490
490
|
if (mentions?.length) {
|
package/src/token.ts
CHANGED
|
@@ -104,7 +104,11 @@ export const CommandIDs = {
|
|
|
104
104
|
/**
|
|
105
105
|
* Rename the current chat.
|
|
106
106
|
*/
|
|
107
|
-
renameChat: 'jupyterlab-chat:renameChat'
|
|
107
|
+
renameChat: 'jupyterlab-chat:renameChat',
|
|
108
|
+
/**
|
|
109
|
+
* Open a chat and send a message into it.
|
|
110
|
+
*/
|
|
111
|
+
openWithMessage: 'jupyterlab-chat:openWithMessage'
|
|
108
112
|
};
|
|
109
113
|
|
|
110
114
|
/**
|