@difizen/libro-ai-native 0.3.2 → 0.3.4
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/es/ai-native-for-cell-view.d.ts +1 -0
- package/es/ai-native-for-cell-view.d.ts.map +1 -1
- package/es/ai-native-for-cell-view.js +5 -0
- package/es/chat-view.d.ts +1 -0
- package/es/chat-view.d.ts.map +1 -1
- package/es/chat-view.js +2 -0
- package/es/libro-ai-native-chat-view.d.ts +1 -0
- package/es/libro-ai-native-chat-view.d.ts.map +1 -1
- package/es/libro-ai-native-chat-view.js +4 -1
- package/package.json +10 -7
- package/src/ai-native-for-cell-view.tsx +4 -0
- package/src/chat-view.tsx +1 -0
- package/src/libro-ai-native-chat-view.tsx +3 -0
|
@@ -4,6 +4,7 @@ import type { ToAutoFactory } from '@difizen/magent-core';
|
|
|
4
4
|
import { Fetcher } from '@difizen/magent-core';
|
|
5
5
|
import type { ViewComponent } from '@difizen/mana-app';
|
|
6
6
|
import { BaseView } from '@difizen/mana-app';
|
|
7
|
+
import 'katex/dist/katex.min.css';
|
|
7
8
|
import { LibroAIChatMessageItemModel } from './libro-ai-msg-item-model.js';
|
|
8
9
|
import type { IAINativeForCellViewOption } from './protocol.js';
|
|
9
10
|
export declare function LibroAINativeForCellRender(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-native-for-cell-view.d.ts","sourceRoot":"","sources":["../src/ai-native-for-cell-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAmB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-native-for-cell-view.d.ts","sourceRoot":"","sources":["../src/ai-native-for-cell-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAmB,MAAM,mBAAmB,CAAC;AAS9D,OAAO,0BAA0B,CAAC;AAKlC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAGhE,wBAAgB,0BAA0B,mDAiDzC;AAED,qBAEa,wBAAyB,SAAQ,QAAQ;IAC3C,IAAI,EAAE,aAAa,CAA8B;IACzC,OAAO,EAAE,OAAO,CAAC;IAClC,IAAI,EAAE,QAAQ,CAAC;IAEf,6BAA6B,EAAE,aAAa,CAAC,OAAO,2BAA2B,CAAC,CAAC;IAEjF,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;IAG1D,MAAM,UAAS;gBACiB,OAAO,EAAE,0BAA0B;IAMnE,UAAU,WAAkB,YAAY,mBA+DtC;CACH"}
|
|
@@ -33,8 +33,12 @@ import { BaseView, transient, view } from '@difizen/mana-app';
|
|
|
33
33
|
import { l10n } from '@difizen/mana-l10n';
|
|
34
34
|
import { Button } from 'antd';
|
|
35
35
|
import { EventSourceParserStream } from 'eventsource-parser/stream';
|
|
36
|
+
import rehypeKatex from 'rehype-katex';
|
|
37
|
+
import rehypeRaw from 'rehype-raw';
|
|
36
38
|
import breaks from 'remark-breaks';
|
|
37
39
|
import remarkGfm from 'remark-gfm';
|
|
40
|
+
import 'katex/dist/katex.min.css'; // 引入 KaTeX 样式
|
|
41
|
+
|
|
38
42
|
import { CodeBlockInCell } from "./ai-native-code-block.js";
|
|
39
43
|
import { LibroAINativeService } from "./ai-native-service.js";
|
|
40
44
|
import { AILoadding } from "./icon.js";
|
|
@@ -61,6 +65,7 @@ export function LibroAINativeForCellRender() {
|
|
|
61
65
|
code: CodeBlockInCell
|
|
62
66
|
},
|
|
63
67
|
remarkPlugins: [remarkGfm, breaks],
|
|
68
|
+
rehypePlugins: [rehypeKatex, rehypeRaw],
|
|
64
69
|
children: (msgItem === null || msgItem === void 0 ? void 0 : msgItem.content) || ''
|
|
65
70
|
}), /*#__PURE__*/_jsx(Button, {
|
|
66
71
|
color: "default",
|
package/es/chat-view.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DisplayView, LibroView } from '@difizen/libro-jupyter';
|
|
2
2
|
import type { ConfigurationService } from '@difizen/mana-app';
|
|
3
3
|
import { BaseView, ViewManager } from '@difizen/mana-app';
|
|
4
|
+
import 'katex/dist/katex.min.css';
|
|
4
5
|
import { LibroAINativeService } from './ai-native-service.js';
|
|
5
6
|
import { LibroAiNativeChatView } from './libro-ai-native-chat-view.js';
|
|
6
7
|
import type { AiNativeChatViewOption } from './protocol.js';
|
package/es/chat-view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-view.d.ts","sourceRoot":"","sources":["../src/chat-view.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,QAAQ,EAKR,WAAW,EAIZ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-view.d.ts","sourceRoot":"","sources":["../src/chat-view.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,QAAQ,EAKR,WAAW,EAIZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAG5D,eAAO,MAAM,UAAU,+CA6DtB,CAAC;AAEF,qBAEa,aAAc,SAAQ,QAAS,YAAW,WAAW;IAChE,MAAM,EAAE,SAAS,GAAG,SAAS,CAAa;IAC1C,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAChC,WAAW,EAAE,WAAW,CAAC;IAChB,oBAAoB,EAAE,oBAAoB,CAAC;IAEhE,IAAI,gDAAc;IAG3B,QAAQ,EAAE,qBAAqB,CAAC;IAGhC,SAAS,UAAQ;IAEX,mBAAmB,CAAC,MAAM,EAAE,sBAAsB;CAmCzD"}
|
package/es/chat-view.js
CHANGED
|
@@ -22,6 +22,8 @@ import { CloseOutlined } from '@ant-design/icons';
|
|
|
22
22
|
import { LibroContextKey, LibroSlotManager, LibroSlotView } from '@difizen/libro-jupyter';
|
|
23
23
|
import { BaseView, prop, transient, view, inject, ViewManager, useInject, ViewInstance, ViewRender } from '@difizen/mana-app';
|
|
24
24
|
import { useRef } from 'react';
|
|
25
|
+
import 'katex/dist/katex.min.css'; // 引入 KaTeX 样式
|
|
26
|
+
|
|
25
27
|
import { LibroAINativeService } from "./ai-native-service.js";
|
|
26
28
|
import { LibroAiNativeChatView } from "./libro-ai-native-chat-view.js";
|
|
27
29
|
import { cancelCellAIClassname } from "./utils.js";
|
|
@@ -16,6 +16,7 @@ export declare class LibroAiNativeChatView extends ChatView {
|
|
|
16
16
|
img: ({ src, alt }: any) => JSX.Element;
|
|
17
17
|
};
|
|
18
18
|
remarkPlugins: (typeof remarkGfm | typeof breaks)[];
|
|
19
|
+
rehypePlugins: any[];
|
|
19
20
|
};
|
|
20
21
|
protected toMessageOption(msgContent: string): {
|
|
21
22
|
sender: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-ai-native-chat-view.d.ts","sourceRoot":"","sources":["../src/libro-ai-native-chat-view.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAkB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-ai-native-chat-view.d.ts","sourceRoot":"","sources":["../src/libro-ai-native-chat-view.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAkB,MAAM,sBAAsB,CAAC;AAIhE,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAM5D,qBAEa,qBAAsB,SAAQ,QAAQ;IAEjD,UAAU,UAAS;IAEnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,IAAI,CAAC,EAAE,QAAQ,CAAC;gBAEgB,MAAM,EAAE,sBAAsB;IAMrD,gBAAgB;;;;;;;;cAQN,eAAe,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CAiBtD"}
|
|
@@ -20,6 +20,8 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con
|
|
|
20
20
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
21
21
|
import { ChatView, ChatComponents } from '@difizen/magent-chat';
|
|
22
22
|
import { inject, prop, transient, view, ViewOption } from '@difizen/mana-app';
|
|
23
|
+
import rehypeKatex from 'rehype-katex';
|
|
24
|
+
import rehypeRaw from 'rehype-raw';
|
|
23
25
|
import breaks from 'remark-breaks';
|
|
24
26
|
import remarkGfm from 'remark-gfm';
|
|
25
27
|
import { CodeBlockInChat } from "./ai-native-code-block.js";
|
|
@@ -47,7 +49,8 @@ export var LibroAiNativeChatView = (_dec = transient(), _dec2 = view(viewId), _d
|
|
|
47
49
|
code: CodeBlockInChat,
|
|
48
50
|
img: ImageModal
|
|
49
51
|
},
|
|
50
|
-
remarkPlugins: [remarkGfm, breaks]
|
|
52
|
+
remarkPlugins: [remarkGfm, breaks],
|
|
53
|
+
rehypePlugins: [rehypeRaw, rehypeKatex]
|
|
51
54
|
};
|
|
52
55
|
}
|
|
53
56
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-ai-native",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -32,18 +32,21 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@difizen/libro-jupyter": "^0.3.2",
|
|
36
|
-
"@difizen/libro-code-editor": "^0.3.2",
|
|
37
35
|
"@ant-design/icons": "^5.4.0",
|
|
38
|
-
"@difizen/
|
|
39
|
-
"@difizen/
|
|
40
|
-
"@difizen/magent-libro": "^0.1.27",
|
|
36
|
+
"@difizen/libro-code-editor": "^0.3.4",
|
|
37
|
+
"@difizen/libro-jupyter": "^0.3.4",
|
|
41
38
|
"@difizen/magent-chat": "^0.1.27",
|
|
42
39
|
"@difizen/magent-core": "^0.1.27",
|
|
40
|
+
"@difizen/magent-libro": "^0.1.27",
|
|
41
|
+
"@difizen/mana-app": "latest",
|
|
42
|
+
"@difizen/mana-l10n": "latest",
|
|
43
43
|
"copy-to-clipboard": "^3.3.3",
|
|
44
44
|
"eventsource-parser": "^1.1.2",
|
|
45
|
-
"
|
|
45
|
+
"katex": "^0.16.10",
|
|
46
46
|
"markdown-it": "^13.0.1",
|
|
47
|
+
"react-syntax-highlighter": "^15.5.0",
|
|
48
|
+
"rehype-katex": "^7.0.1",
|
|
49
|
+
"rehype-raw": "^7.0.0",
|
|
47
50
|
"remark-breaks": "^4.0.0",
|
|
48
51
|
"remark-gfm": "^4.0.0",
|
|
49
52
|
"uuid": "^9.0.0"
|
|
@@ -18,8 +18,11 @@ import { l10n } from '@difizen/mana-l10n';
|
|
|
18
18
|
import { Button } from 'antd';
|
|
19
19
|
import type { ParsedEvent } from 'eventsource-parser/stream';
|
|
20
20
|
import { EventSourceParserStream } from 'eventsource-parser/stream';
|
|
21
|
+
import rehypeKatex from 'rehype-katex';
|
|
22
|
+
import rehypeRaw from 'rehype-raw';
|
|
21
23
|
import breaks from 'remark-breaks';
|
|
22
24
|
import remarkGfm from 'remark-gfm';
|
|
25
|
+
import 'katex/dist/katex.min.css'; // 引入 KaTeX 样式
|
|
23
26
|
|
|
24
27
|
import { CodeBlockInCell } from './ai-native-code-block.js';
|
|
25
28
|
import { LibroAINativeService } from './ai-native-service.js';
|
|
@@ -49,6 +52,7 @@ export function LibroAINativeForCellRender() {
|
|
|
49
52
|
type="message"
|
|
50
53
|
components={{ code: CodeBlockInCell }}
|
|
51
54
|
remarkPlugins={[remarkGfm, breaks]}
|
|
55
|
+
rehypePlugins={[rehypeKatex, rehypeRaw]}
|
|
52
56
|
>
|
|
53
57
|
{msgItem?.content || ''}
|
|
54
58
|
</LLMRender>
|
package/src/chat-view.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ViewRender,
|
|
19
19
|
} from '@difizen/mana-app';
|
|
20
20
|
import { useRef } from 'react';
|
|
21
|
+
import 'katex/dist/katex.min.css'; // 引入 KaTeX 样式
|
|
21
22
|
|
|
22
23
|
import { LibroAINativeService } from './ai-native-service.js';
|
|
23
24
|
import { LibroAiNativeChatView } from './libro-ai-native-chat-view.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CellView, LibroView } from '@difizen/libro-jupyter';
|
|
2
2
|
import { ChatView, ChatComponents } from '@difizen/magent-chat';
|
|
3
3
|
import { inject, prop, transient, view, ViewOption } from '@difizen/mana-app';
|
|
4
|
+
import rehypeKatex from 'rehype-katex';
|
|
5
|
+
import rehypeRaw from 'rehype-raw';
|
|
4
6
|
import breaks from 'remark-breaks';
|
|
5
7
|
import remarkGfm from 'remark-gfm';
|
|
6
8
|
|
|
@@ -32,6 +34,7 @@ export class LibroAiNativeChatView extends ChatView {
|
|
|
32
34
|
return {
|
|
33
35
|
components: { code: CodeBlockInChat, img: ImageModal },
|
|
34
36
|
remarkPlugins: [remarkGfm, breaks],
|
|
37
|
+
rehypePlugins: [rehypeRaw, rehypeKatex] as any[],
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
40
|
|