@jupyter/chat 0.18.0 → 0.18.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/widgets/chat-sidebar.d.ts +2 -2
- package/lib/widgets/chat-sidebar.js +6 -8
- package/lib/widgets/multichat-panel.d.ts +2 -2
- package/lib/widgets/multichat-panel.js +5 -4
- package/package.json +1 -1
- package/src/widgets/chat-sidebar.tsx +7 -9
- package/src/widgets/multichat-panel.tsx +8 -7
- package/style/chat.css +1 -1
- package/style/input.css +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReactWidget } from '@jupyterlab/apputils';
|
|
2
1
|
import { Chat } from '../components/chat';
|
|
3
|
-
|
|
2
|
+
import { ChatWidget } from './chat-widget';
|
|
3
|
+
export declare function buildChatSidebar(options: Chat.IOptions): ChatWidget;
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Jupyter Development Team.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { ReactWidget } from '@jupyterlab/apputils';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { Chat } from '../components/chat';
|
|
8
5
|
import { chatIcon } from '../icons';
|
|
6
|
+
import { ChatWidget } from './chat-widget';
|
|
9
7
|
export function buildChatSidebar(options) {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
8
|
+
const widget = new ChatWidget(options);
|
|
9
|
+
widget.id = 'jupyter-chat::side-panel';
|
|
10
|
+
widget.title.icon = chatIcon;
|
|
11
|
+
widget.title.caption = 'Jupyter Chat'; // TODO: i18n
|
|
12
|
+
return widget;
|
|
15
13
|
}
|
|
@@ -110,7 +110,7 @@ export declare namespace MultiChatPanel {
|
|
|
110
110
|
*
|
|
111
111
|
* @param name - the name of the chat to move.
|
|
112
112
|
*/
|
|
113
|
-
openInMain?: (name: string) =>
|
|
113
|
+
openInMain?: (name: string) => Promise<boolean>;
|
|
114
114
|
/**
|
|
115
115
|
* An optional callback to rename a chat.
|
|
116
116
|
*
|
|
@@ -195,7 +195,7 @@ export declare namespace ChatSection {
|
|
|
195
195
|
*
|
|
196
196
|
* @param name - the name of the chat to move.
|
|
197
197
|
*/
|
|
198
|
-
openInMain?: (name: string) =>
|
|
198
|
+
openInMain?: (name: string) => Promise<boolean>;
|
|
199
199
|
/**
|
|
200
200
|
* An optional callback to rename a chat.
|
|
201
201
|
*
|
|
@@ -280,12 +280,13 @@ export class ChatSection extends PanelWithToolbar {
|
|
|
280
280
|
icon: launchIcon,
|
|
281
281
|
iconLabel: 'Move the chat to the main area',
|
|
282
282
|
className: 'jp-mod-styled',
|
|
283
|
-
onClick: () => {
|
|
283
|
+
onClick: async () => {
|
|
284
284
|
var _a;
|
|
285
285
|
const name = this.model.name;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
if (await ((_a = options.openInMain) === null || _a === void 0 ? void 0 : _a.call(options, name))) {
|
|
287
|
+
this.model.dispose();
|
|
288
|
+
this.dispose();
|
|
289
|
+
}
|
|
289
290
|
}
|
|
290
291
|
});
|
|
291
292
|
this.toolbar.addItem('moveMain', moveToMain);
|
package/package.json
CHANGED
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ReactWidget } from '@jupyterlab/apputils';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
6
|
import { Chat } from '../components/chat';
|
|
10
7
|
import { chatIcon } from '../icons';
|
|
8
|
+
import { ChatWidget } from './chat-widget';
|
|
11
9
|
|
|
12
|
-
export function buildChatSidebar(options: Chat.IOptions):
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
10
|
+
export function buildChatSidebar(options: Chat.IOptions): ChatWidget {
|
|
11
|
+
const widget = new ChatWidget(options);
|
|
12
|
+
widget.id = 'jupyter-chat::side-panel';
|
|
13
|
+
widget.title.icon = chatIcon;
|
|
14
|
+
widget.title.caption = 'Jupyter Chat'; // TODO: i18n
|
|
15
|
+
return widget;
|
|
18
16
|
}
|
|
@@ -279,7 +279,7 @@ export class MultiChatPanel extends SidePanel {
|
|
|
279
279
|
name?: string
|
|
280
280
|
) => Promise<MultiChatPanel.IAddChatArgs>;
|
|
281
281
|
private _getChatNames?: () => Promise<{ [name: string]: string }>;
|
|
282
|
-
private _openInMain?: (name: string) =>
|
|
282
|
+
private _openInMain?: (name: string) => Promise<boolean>;
|
|
283
283
|
private _renameChat?: (oldName: string, newName: string) => Promise<boolean>;
|
|
284
284
|
|
|
285
285
|
private _openChatWidget?: ReactWidget;
|
|
@@ -317,7 +317,7 @@ export namespace MultiChatPanel {
|
|
|
317
317
|
*
|
|
318
318
|
* @param name - the name of the chat to move.
|
|
319
319
|
*/
|
|
320
|
-
openInMain?: (name: string) =>
|
|
320
|
+
openInMain?: (name: string) => Promise<boolean>;
|
|
321
321
|
/**
|
|
322
322
|
* An optional callback to rename a chat.
|
|
323
323
|
*
|
|
@@ -406,11 +406,12 @@ export class ChatSection extends PanelWithToolbar {
|
|
|
406
406
|
icon: launchIcon,
|
|
407
407
|
iconLabel: 'Move the chat to the main area',
|
|
408
408
|
className: 'jp-mod-styled',
|
|
409
|
-
onClick: () => {
|
|
409
|
+
onClick: async () => {
|
|
410
410
|
const name = this.model.name;
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
if (await options.openInMain?.(name)) {
|
|
412
|
+
this.model.dispose();
|
|
413
|
+
this.dispose();
|
|
414
|
+
}
|
|
414
415
|
}
|
|
415
416
|
});
|
|
416
417
|
this.toolbar.addItem('moveMain', moveToMain);
|
|
@@ -521,7 +522,7 @@ export namespace ChatSection {
|
|
|
521
522
|
*
|
|
522
523
|
* @param name - the name of the chat to move.
|
|
523
524
|
*/
|
|
524
|
-
openInMain?: (name: string) =>
|
|
525
|
+
openInMain?: (name: string) => Promise<boolean>;
|
|
525
526
|
/**
|
|
526
527
|
* An optional callback to rename a chat.
|
|
527
528
|
*
|
package/style/chat.css
CHANGED