@difizen/libro-ai-native 0.2.42 → 0.2.44
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-command-contribution.js +1 -1
- package/es/index.less +4 -2
- package/es/libro-ai-native-chat-view.d.ts +2 -2
- package/es/libro-ai-native-chat-view.d.ts.map +1 -1
- package/es/libro-ai-native-chat-view.js +2 -2
- package/es/utils.d.ts +0 -1
- package/es/utils.d.ts.map +1 -1
- package/es/utils.js +0 -98
- package/package.json +2 -3
- package/src/ai-native-command-contribution.tsx +2 -2
- package/src/index.less +4 -2
- package/src/libro-ai-native-chat-view.tsx +3 -2
- package/src/utils.tsx +0 -82
|
@@ -248,7 +248,7 @@ export var LibroAINativeCommandContribution = (_dec = singleton({
|
|
|
248
248
|
libroAINativeForCellView = _context4.sent;
|
|
249
249
|
libroAINativeForCellView.showAI = true;
|
|
250
250
|
addCellAIClassname(cell);
|
|
251
|
-
code = l10n.getLang() === 'en-US' ? "Could you please explain this piece of code?\uFF1A".concat(cell.model.value
|
|
251
|
+
code = l10n.getLang() === 'en-US' ? "Could you please explain this piece of code?\uFF1A".concat(cell.model.value) : "\u5E2E\u5FD9\u89E3\u91CA\u4E00\u4E0B\u8FD9\u6BB5\u4EE3\u7801\uFF1A".concat(cell.model.value);
|
|
252
252
|
libroAINativeForCellView.chatStream({
|
|
253
253
|
content: code
|
|
254
254
|
});
|
package/es/index.less
CHANGED
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
|
|
208
208
|
.chat-msg-md-message {
|
|
209
209
|
color: var(--mana-libro-llm-response-output-text-color);
|
|
210
|
-
width: calc(100% -
|
|
210
|
+
width: calc(100% - 104px);
|
|
211
211
|
margin-right: 12px;
|
|
212
212
|
|
|
213
213
|
code {
|
|
@@ -261,6 +261,7 @@
|
|
|
261
261
|
|
|
262
262
|
.chat-msg-md-code-code {
|
|
263
263
|
display: inline;
|
|
264
|
+
font-size: 13px;
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
.libro-ai-native-for-cell-container {
|
|
@@ -273,9 +274,10 @@
|
|
|
273
274
|
code {
|
|
274
275
|
background-color: unset;
|
|
275
276
|
padding: unset;
|
|
277
|
+
font-size: 13px;
|
|
276
278
|
}
|
|
277
279
|
|
|
278
|
-
padding: 12px;
|
|
280
|
+
padding: 22px 12px 12px;
|
|
279
281
|
background-color: var(--mana-libro-input-background) !important;
|
|
280
282
|
color: var(--mana-libro-llm-response-output-text-color);
|
|
281
283
|
font-family:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" resolution-mode="require"/>
|
|
1
2
|
import type { CellView, LibroView } from '@difizen/libro-jupyter';
|
|
2
3
|
import { ChatView } from '@difizen/magent-chat';
|
|
3
4
|
import breaks from 'remark-breaks';
|
|
4
5
|
import remarkGfm from 'remark-gfm';
|
|
5
6
|
import './index.less';
|
|
6
7
|
import type { AiNativeChatViewOption } from './protocol.js';
|
|
7
|
-
import { ImageModal } from './utils.js';
|
|
8
8
|
export declare class LibroAiNativeChatView extends ChatView {
|
|
9
9
|
isCellChat: boolean;
|
|
10
10
|
libro?: LibroView;
|
|
@@ -13,7 +13,7 @@ export declare class LibroAiNativeChatView extends ChatView {
|
|
|
13
13
|
getMarkdownProps(): {
|
|
14
14
|
components: {
|
|
15
15
|
code: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
img:
|
|
16
|
+
img: ({ src, alt }: any) => JSX.Element;
|
|
17
17
|
};
|
|
18
18
|
remarkPlugins: (typeof remarkGfm | typeof breaks)[];
|
|
19
19
|
};
|
|
@@ -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,
|
|
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;AAEhE,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;;;;;;;cAON,eAAe,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CAiBtD"}
|
|
@@ -18,14 +18,14 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
18
18
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
19
19
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
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
|
-
import { ChatView } from '@difizen/magent-chat';
|
|
21
|
+
import { ChatView, ChatComponents } from '@difizen/magent-chat';
|
|
22
22
|
import { inject, prop, transient, view, ViewOption } from '@difizen/mana-app';
|
|
23
23
|
import breaks from 'remark-breaks';
|
|
24
24
|
import remarkGfm from 'remark-gfm';
|
|
25
25
|
import { CodeBlockInChat } from "./ai-native-code-block.js";
|
|
26
26
|
import "./index.less";
|
|
27
|
-
import { ImageModal } from "./utils.js";
|
|
28
27
|
var viewId = 'magent-chat';
|
|
28
|
+
var ImageModal = ChatComponents.ImageModal;
|
|
29
29
|
export var LibroAiNativeChatView = (_dec = transient(), _dec2 = view(viewId), _dec3 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_ChatView) {
|
|
30
30
|
_inherits(LibroAiNativeChatView, _ChatView);
|
|
31
31
|
var _super = _createSuper(LibroAiNativeChatView);
|
package/es/utils.d.ts
CHANGED
|
@@ -2,5 +2,4 @@ import type { CellView } from '@difizen/libro-jupyter';
|
|
|
2
2
|
export declare function stringToReadableStream(inputString: string): ReadableStream<any>;
|
|
3
3
|
export declare function addCellAIClassname(cell: CellView): void;
|
|
4
4
|
export declare function cancelCellAIClassname(cell: CellView): void;
|
|
5
|
-
export declare function ImageModal({ src, alt }: any): import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
//# sourceMappingURL=utils.d.ts.map
|
package/es/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,uBAgBzD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,QAMhD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,QAInD"}
|
package/es/utils.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { Modal } from 'antd';
|
|
8
|
-
import { useEffect, useState } from 'react';
|
|
9
|
-
import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
1
|
export function stringToReadableStream(inputString) {
|
|
13
2
|
// Convert the string into a Uint8Array
|
|
14
3
|
var encoder = new TextEncoder();
|
|
@@ -39,91 +28,4 @@ export function cancelCellAIClassname(cell) {
|
|
|
39
28
|
var _cell$className3;
|
|
40
29
|
cell.className = (_cell$className3 = cell.className) === null || _cell$className3 === void 0 ? void 0 : _cell$className3.replace(' ai-cell-focus', '');
|
|
41
30
|
}
|
|
42
|
-
}
|
|
43
|
-
export function ImageModal(_ref) {
|
|
44
|
-
var src = _ref.src,
|
|
45
|
-
alt = _ref.alt;
|
|
46
|
-
var _useState = useState(false),
|
|
47
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
-
visible = _useState2[0],
|
|
49
|
-
setVisible = _useState2[1];
|
|
50
|
-
var _useState3 = useState({
|
|
51
|
-
width: 0,
|
|
52
|
-
height: 0
|
|
53
|
-
}),
|
|
54
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
-
imageDimensions = _useState4[0],
|
|
56
|
-
setImageDimensions = _useState4[1];
|
|
57
|
-
useEffect(function () {
|
|
58
|
-
var img = new Image();
|
|
59
|
-
img.src = src;
|
|
60
|
-
img.onload = function () {
|
|
61
|
-
setImageDimensions({
|
|
62
|
-
width: img.width,
|
|
63
|
-
height: img.height
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
}, [src]);
|
|
67
|
-
var maxModalWidth = window.innerWidth * 0.8; // 80% of the viewport width
|
|
68
|
-
var maxModalHeight = window.innerHeight * 0.8; // 80% of the viewport height
|
|
69
|
-
|
|
70
|
-
var adjustedWidth, adjustedHeight;
|
|
71
|
-
var aspectRatio = imageDimensions.width / imageDimensions.height;
|
|
72
|
-
if (imageDimensions.width > maxModalWidth) {
|
|
73
|
-
adjustedWidth = maxModalWidth;
|
|
74
|
-
adjustedHeight = adjustedWidth / aspectRatio;
|
|
75
|
-
} else if (imageDimensions.height > maxModalHeight) {
|
|
76
|
-
adjustedHeight = maxModalHeight;
|
|
77
|
-
adjustedWidth = adjustedHeight * aspectRatio;
|
|
78
|
-
} else {
|
|
79
|
-
adjustedWidth = imageDimensions.width;
|
|
80
|
-
adjustedHeight = imageDimensions.height;
|
|
81
|
-
}
|
|
82
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
83
|
-
children: [/*#__PURE__*/_jsx("img", {
|
|
84
|
-
src: src,
|
|
85
|
-
alt: alt,
|
|
86
|
-
style: {
|
|
87
|
-
cursor: 'pointer'
|
|
88
|
-
},
|
|
89
|
-
onClick: function onClick() {
|
|
90
|
-
return setVisible(true);
|
|
91
|
-
},
|
|
92
|
-
onLoad: function onLoad() {
|
|
93
|
-
var _document$getElementB;
|
|
94
|
-
// 解决生成图片没有滚动到最下方的问题。
|
|
95
|
-
(_document$getElementB = document.getElementById('chat-main-scroll')) === null || _document$getElementB === void 0 || _document$getElementB.scrollIntoView(false);
|
|
96
|
-
}
|
|
97
|
-
}), /*#__PURE__*/_jsx(Modal, {
|
|
98
|
-
open: visible,
|
|
99
|
-
closeIcon: false,
|
|
100
|
-
footer: null,
|
|
101
|
-
width: adjustedWidth + 30,
|
|
102
|
-
onCancel: function onCancel() {
|
|
103
|
-
return setVisible(false);
|
|
104
|
-
},
|
|
105
|
-
bodyStyle: {
|
|
106
|
-
padding: 0,
|
|
107
|
-
display: 'flex',
|
|
108
|
-
justifyContent: 'center',
|
|
109
|
-
alignItems: 'center',
|
|
110
|
-
height: adjustedHeight
|
|
111
|
-
},
|
|
112
|
-
children: /*#__PURE__*/_jsx(TransformWrapper, {
|
|
113
|
-
initialScale: 1,
|
|
114
|
-
initialPositionX: 0,
|
|
115
|
-
initialPositionY: 0,
|
|
116
|
-
children: /*#__PURE__*/_jsx(TransformComponent, {
|
|
117
|
-
children: /*#__PURE__*/_jsx("img", {
|
|
118
|
-
src: src,
|
|
119
|
-
alt: alt,
|
|
120
|
-
style: {
|
|
121
|
-
width: '100%',
|
|
122
|
-
height: '100%'
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
})
|
|
126
|
-
})
|
|
127
|
-
})]
|
|
128
|
-
});
|
|
129
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-ai-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.44",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@difizen/libro-jupyter": "^0.2.
|
|
35
|
+
"@difizen/libro-jupyter": "^0.2.44",
|
|
36
36
|
"@ant-design/icons": "^5.4.0",
|
|
37
|
-
"react-zoom-pan-pinch": "^3.6.1",
|
|
38
37
|
"@difizen/mana-app": "latest",
|
|
39
38
|
"@difizen/mana-l10n": "latest",
|
|
40
39
|
"@difizen/magent-libro": "^0.1.27",
|
|
@@ -200,8 +200,8 @@ export class LibroAINativeCommandContribution
|
|
|
200
200
|
addCellAIClassname(cell);
|
|
201
201
|
const code =
|
|
202
202
|
l10n.getLang() === 'en-US'
|
|
203
|
-
? `Could you please explain this piece of code?:${cell.model.value}
|
|
204
|
-
:
|
|
203
|
+
? `Could you please explain this piece of code?:${cell.model.value}`
|
|
204
|
+
: `帮忙解释一下这段代码:${cell.model.value}`;
|
|
205
205
|
libroAINativeForCellView.chatStream({
|
|
206
206
|
content: code,
|
|
207
207
|
});
|
package/src/index.less
CHANGED
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
|
|
208
208
|
.chat-msg-md-message {
|
|
209
209
|
color: var(--mana-libro-llm-response-output-text-color);
|
|
210
|
-
width: calc(100% -
|
|
210
|
+
width: calc(100% - 104px);
|
|
211
211
|
margin-right: 12px;
|
|
212
212
|
|
|
213
213
|
code {
|
|
@@ -261,6 +261,7 @@
|
|
|
261
261
|
|
|
262
262
|
.chat-msg-md-code-code {
|
|
263
263
|
display: inline;
|
|
264
|
+
font-size: 13px;
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
.libro-ai-native-for-cell-container {
|
|
@@ -273,9 +274,10 @@
|
|
|
273
274
|
code {
|
|
274
275
|
background-color: unset;
|
|
275
276
|
padding: unset;
|
|
277
|
+
font-size: 13px;
|
|
276
278
|
}
|
|
277
279
|
|
|
278
|
-
padding: 12px;
|
|
280
|
+
padding: 22px 12px 12px;
|
|
279
281
|
background-color: var(--mana-libro-input-background) !important;
|
|
280
282
|
color: var(--mana-libro-llm-response-output-text-color);
|
|
281
283
|
font-family:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CellView, LibroView } from '@difizen/libro-jupyter';
|
|
2
|
-
import { ChatView } from '@difizen/magent-chat';
|
|
2
|
+
import { ChatView, ChatComponents } from '@difizen/magent-chat';
|
|
3
3
|
import { inject, prop, transient, view, ViewOption } from '@difizen/mana-app';
|
|
4
4
|
import breaks from 'remark-breaks';
|
|
5
5
|
import remarkGfm from 'remark-gfm';
|
|
@@ -7,10 +7,11 @@ import remarkGfm from 'remark-gfm';
|
|
|
7
7
|
import { CodeBlockInChat } from './ai-native-code-block.js';
|
|
8
8
|
import './index.less';
|
|
9
9
|
import type { AiNativeChatViewOption } from './protocol.js';
|
|
10
|
-
import { ImageModal } from './utils.js';
|
|
11
10
|
|
|
12
11
|
const viewId = 'magent-chat';
|
|
13
12
|
|
|
13
|
+
const ImageModal = ChatComponents.ImageModal as ({ src, alt }: any) => JSX.Element;
|
|
14
|
+
|
|
14
15
|
@transient()
|
|
15
16
|
@view(viewId)
|
|
16
17
|
export class LibroAiNativeChatView extends ChatView {
|
package/src/utils.tsx
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { CellView } from '@difizen/libro-jupyter';
|
|
2
|
-
import { Modal } from 'antd';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch';
|
|
5
2
|
|
|
6
3
|
export function stringToReadableStream(inputString: string) {
|
|
7
4
|
// Convert the string into a Uint8Array
|
|
@@ -34,82 +31,3 @@ export function cancelCellAIClassname(cell: CellView) {
|
|
|
34
31
|
cell.className = cell.className?.replace(' ai-cell-focus', '');
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
export function ImageModal({ src, alt }: any) {
|
|
39
|
-
const [visible, setVisible] = useState(false);
|
|
40
|
-
const [imageDimensions, setImageDimensions] = useState({
|
|
41
|
-
width: 0,
|
|
42
|
-
height: 0,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
const img = new Image();
|
|
47
|
-
img.src = src;
|
|
48
|
-
img.onload = () => {
|
|
49
|
-
setImageDimensions({
|
|
50
|
-
width: img.width,
|
|
51
|
-
height: img.height,
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
}, [src]);
|
|
55
|
-
|
|
56
|
-
const maxModalWidth = window.innerWidth * 0.8; // 80% of the viewport width
|
|
57
|
-
const maxModalHeight = window.innerHeight * 0.8; // 80% of the viewport height
|
|
58
|
-
|
|
59
|
-
let adjustedWidth, adjustedHeight;
|
|
60
|
-
|
|
61
|
-
const aspectRatio = imageDimensions.width / imageDimensions.height;
|
|
62
|
-
|
|
63
|
-
if (imageDimensions.width > maxModalWidth) {
|
|
64
|
-
adjustedWidth = maxModalWidth;
|
|
65
|
-
adjustedHeight = adjustedWidth / aspectRatio;
|
|
66
|
-
} else if (imageDimensions.height > maxModalHeight) {
|
|
67
|
-
adjustedHeight = maxModalHeight;
|
|
68
|
-
adjustedWidth = adjustedHeight * aspectRatio;
|
|
69
|
-
} else {
|
|
70
|
-
adjustedWidth = imageDimensions.width;
|
|
71
|
-
adjustedHeight = imageDimensions.height;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<div>
|
|
76
|
-
<img
|
|
77
|
-
src={src}
|
|
78
|
-
alt={alt}
|
|
79
|
-
style={{ cursor: 'pointer' }}
|
|
80
|
-
onClick={() => setVisible(true)}
|
|
81
|
-
onLoad={() => {
|
|
82
|
-
// 解决生成图片没有滚动到最下方的问题。
|
|
83
|
-
document.getElementById('chat-main-scroll')?.scrollIntoView(false);
|
|
84
|
-
}}
|
|
85
|
-
/>
|
|
86
|
-
<Modal
|
|
87
|
-
open={visible}
|
|
88
|
-
closeIcon={false}
|
|
89
|
-
footer={null}
|
|
90
|
-
width={adjustedWidth + 30}
|
|
91
|
-
onCancel={() => setVisible(false)}
|
|
92
|
-
bodyStyle={{
|
|
93
|
-
padding: 0,
|
|
94
|
-
display: 'flex',
|
|
95
|
-
justifyContent: 'center',
|
|
96
|
-
alignItems: 'center',
|
|
97
|
-
height: adjustedHeight,
|
|
98
|
-
}}
|
|
99
|
-
>
|
|
100
|
-
<TransformWrapper initialScale={1} initialPositionX={0} initialPositionY={0}>
|
|
101
|
-
<TransformComponent>
|
|
102
|
-
<img
|
|
103
|
-
src={src}
|
|
104
|
-
alt={alt}
|
|
105
|
-
style={{
|
|
106
|
-
width: '100%',
|
|
107
|
-
height: '100%',
|
|
108
|
-
}}
|
|
109
|
-
/>
|
|
110
|
-
</TransformComponent>
|
|
111
|
-
</TransformWrapper>
|
|
112
|
-
</Modal>
|
|
113
|
-
</div>
|
|
114
|
-
);
|
|
115
|
-
}
|