@myun/gimi-chat 0.9.35 → 0.9.37
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/dist/components/ai-loading/index.d.ts +4 -1
- package/dist/components/ai-loading/index.js +7 -3
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +2 -2
- package/dist/components/knowledge-trace/index.module.css +3 -4
- package/dist/components/knowledge-trace/tryWatch.js +15 -117
- package/dist/components/upload-list/ImageFile.js +4 -3
- package/dist/components/upload-list/imageFile.module.css +7 -0
- package/dist/i18n/locales/en-US.js +1 -1
- package/dist/i18n/locales/zh-CN.js +1 -1
- package/dist/umd/index.min.js +1 -1
- package/package.json +1 -1
|
@@ -2,15 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import styles from "./index.module.css";
|
|
4
4
|
import LottieImg from "../lottie-img";
|
|
5
|
-
var AiLoading = function AiLoading() {
|
|
5
|
+
var AiLoading = function AiLoading(_ref) {
|
|
6
|
+
var _ref$size = _ref.size,
|
|
7
|
+
size = _ref$size === void 0 ? [30, 50] : _ref$size,
|
|
8
|
+
_ref$hiddenTitle = _ref.hiddenTitle,
|
|
9
|
+
hiddenTitle = _ref$hiddenTitle === void 0 ? false : _ref$hiddenTitle;
|
|
6
10
|
var _useTranslation = useTranslation(),
|
|
7
11
|
t = _useTranslation.t;
|
|
8
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
9
13
|
className: styles.aiLoading
|
|
10
14
|
}, /*#__PURE__*/React.createElement(LottieImg, {
|
|
11
15
|
name: "aiLoading",
|
|
12
|
-
size:
|
|
13
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
size: size
|
|
17
|
+
}), !hiddenTitle && /*#__PURE__*/React.createElement("div", {
|
|
14
18
|
className: styles.text
|
|
15
19
|
}, t('common.dataLoading')));
|
|
16
20
|
};
|
|
@@ -145,8 +145,8 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
|
|
|
145
145
|
visible: showPanel,
|
|
146
146
|
onVisibleChange: onVisibleChange,
|
|
147
147
|
className: "knowledgeHoverPanel",
|
|
148
|
-
position: "bottomLeft"
|
|
149
|
-
trigger
|
|
148
|
+
position: "bottomLeft"
|
|
149
|
+
// trigger='click'
|
|
150
150
|
}, /*#__PURE__*/React.createElement("div", {
|
|
151
151
|
className: styles.icon_btn,
|
|
152
152
|
onClick: handleIconClick
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
margin: 0;
|
|
90
90
|
border: none;
|
|
91
91
|
border-radius: 20px;
|
|
92
|
-
background: var(--theme-
|
|
92
|
+
background: var(--theme-primary-pale, #F0F8FF);
|
|
93
93
|
font-family: "PingFang SC";
|
|
94
94
|
font-size: 16px;
|
|
95
95
|
font-weight: 500;
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
margin: 0;
|
|
184
184
|
border: none;
|
|
185
185
|
border-radius: 20px;
|
|
186
|
-
background: var(--theme-
|
|
186
|
+
background: var(--theme-primary-pale, #F0F8FF);
|
|
187
187
|
font-size: 16px;
|
|
188
188
|
font-weight: 500;
|
|
189
189
|
line-height: 16px;
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
}
|
|
193
193
|
.unsupportedBtn:hover {
|
|
194
194
|
color: var(--theme-primary, #4086FF);
|
|
195
|
-
background: var(--theme-
|
|
195
|
+
background: var(--theme-primary-pale, #F0F8FF) !important;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
.newsContent {
|
|
@@ -240,7 +240,6 @@
|
|
|
240
240
|
padding-top: 40px;
|
|
241
241
|
background: rgba(255, 255, 255, 0.5);
|
|
242
242
|
backdrop-filter: blur(10px);
|
|
243
|
-
-webkit-backdrop-filter: blur(10px);
|
|
244
243
|
pointer-events: none;
|
|
245
244
|
}
|
|
246
245
|
.newsContent .newsMaskText {
|
|
@@ -16,7 +16,6 @@ import styles from "./index.module.css";
|
|
|
16
16
|
import { Spin } from '@douyinfe/semi-ui';
|
|
17
17
|
import GdPlayer from '@gaodun.com/gplayer';
|
|
18
18
|
import ChatContext from "../templates/chatContext";
|
|
19
|
-
import AiLoading from "../ai-loading";
|
|
20
19
|
import { getFieldConfigsByType } from "./config";
|
|
21
20
|
var SUPPORT_PREVIEW_FILE_TYPE = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
|
|
22
21
|
var SUPPORT_WEB_PREVIEW = ['pdf', 'svg', 'png', 'jpg', 'jpeg', 'gif'];
|
|
@@ -153,99 +152,10 @@ var DocumentPlayer = function DocumentPlayer(_ref5) {
|
|
|
153
152
|
onViewFull = _ref5.onViewFull;
|
|
154
153
|
var _useTranslation2 = useTranslation(),
|
|
155
154
|
t = _useTranslation2.t;
|
|
156
|
-
var _useContext2 = useContext(ChatContext),
|
|
157
|
-
apiService = _useContext2.apiService;
|
|
158
|
-
var _ref6 = apiService,
|
|
159
|
-
getDocumentTrialUrl = _ref6.getDocumentTrialUrl;
|
|
160
155
|
|
|
161
|
-
//
|
|
162
|
-
var _useState3 = useState(''),
|
|
163
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
164
|
-
trialUrl = _useState4[0],
|
|
165
|
-
setTrialUrl = _useState4[1];
|
|
166
|
-
var _useState5 = useState(null),
|
|
167
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
168
|
-
errorKey = _useState6[0],
|
|
169
|
-
setErrorKey = _useState6[1];
|
|
170
|
-
var _useState7 = useState(false),
|
|
171
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
172
|
-
loading = _useState8[0],
|
|
173
|
-
setLoading = _useState8[1];
|
|
174
|
-
|
|
175
|
-
// Office 文档与 Web 可预览类型(pdf/svg/图片)均通过试看接口获取试看地址
|
|
156
|
+
// Office 文档与 Web 可预览类型(pdf/svg/图片)支持试看
|
|
176
157
|
var canPreview = SUPPORT_PREVIEW_FILE_TYPE.includes(item.suffix) || SUPPORT_WEB_PREVIEW.includes(item.suffix);
|
|
177
158
|
|
|
178
|
-
// 业务码 -> i18n key
|
|
179
|
-
var mapTrialError = function mapTrialError(status) {
|
|
180
|
-
switch (status) {
|
|
181
|
-
case 4001:
|
|
182
|
-
return 'trace.document.trialUnsupportedType';
|
|
183
|
-
case 4002:
|
|
184
|
-
return 'trace.document.trialFileTooLarge';
|
|
185
|
-
case 4003:
|
|
186
|
-
return 'trace.document.trialInvalidDoc';
|
|
187
|
-
default:
|
|
188
|
-
return 'trace.document.trialFailed';
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
useEffect(function () {
|
|
192
|
-
if (!canPreview) return;
|
|
193
|
-
var cancelled = false;
|
|
194
|
-
var fetchTrial = /*#__PURE__*/function () {
|
|
195
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
196
|
-
var _res$result, res, isOfficeType;
|
|
197
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
198
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
199
|
-
case 0:
|
|
200
|
-
setLoading(true);
|
|
201
|
-
setErrorKey(null);
|
|
202
|
-
setTrialUrl('');
|
|
203
|
-
_context2.prev = 3;
|
|
204
|
-
_context2.next = 6;
|
|
205
|
-
return getDocumentTrialUrl({
|
|
206
|
-
resourceUrl: item.url
|
|
207
|
-
});
|
|
208
|
-
case 6:
|
|
209
|
-
res = _context2.sent;
|
|
210
|
-
if (!cancelled) {
|
|
211
|
-
_context2.next = 9;
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
return _context2.abrupt("return");
|
|
215
|
-
case 9:
|
|
216
|
-
if (res.status === 0 && (_res$result = res.result) !== null && _res$result !== void 0 && _res$result.trialUrl) {
|
|
217
|
-
// Office 文档:用 Office 在线预览嵌入地址;Web 类型(pdf/图片)直接用 trialUrl
|
|
218
|
-
isOfficeType = SUPPORT_PREVIEW_FILE_TYPE.includes(item.suffix);
|
|
219
|
-
setTrialUrl(isOfficeType ? "https://view.officeapps.live.com/op/embed.aspx?src=".concat(encodeURIComponent(res.result.trialUrl)) : res.result.trialUrl);
|
|
220
|
-
} else {
|
|
221
|
-
setErrorKey(mapTrialError(res.status));
|
|
222
|
-
}
|
|
223
|
-
_context2.next = 15;
|
|
224
|
-
break;
|
|
225
|
-
case 12:
|
|
226
|
-
_context2.prev = 12;
|
|
227
|
-
_context2.t0 = _context2["catch"](3);
|
|
228
|
-
if (!cancelled) setErrorKey('trace.document.trialFailed');
|
|
229
|
-
case 15:
|
|
230
|
-
_context2.prev = 15;
|
|
231
|
-
if (!cancelled) setLoading(false);
|
|
232
|
-
return _context2.finish(15);
|
|
233
|
-
case 18:
|
|
234
|
-
case "end":
|
|
235
|
-
return _context2.stop();
|
|
236
|
-
}
|
|
237
|
-
}, _callee2, null, [[3, 12, 15, 18]]);
|
|
238
|
-
}));
|
|
239
|
-
return function fetchTrial() {
|
|
240
|
-
return _ref7.apply(this, arguments);
|
|
241
|
-
};
|
|
242
|
-
}();
|
|
243
|
-
fetchTrial();
|
|
244
|
-
return function () {
|
|
245
|
-
cancelled = true;
|
|
246
|
-
};
|
|
247
|
-
}, [item.url, canPreview]);
|
|
248
|
-
|
|
249
159
|
// 不支持预览的类型:直接提示并下载
|
|
250
160
|
if (!canPreview) {
|
|
251
161
|
return /*#__PURE__*/React.createElement(UnsupportedView, {
|
|
@@ -255,33 +165,21 @@ var DocumentPlayer = function DocumentPlayer(_ref5) {
|
|
|
255
165
|
});
|
|
256
166
|
}
|
|
257
167
|
|
|
258
|
-
//
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}, /*#__PURE__*/React.createElement(AiLoading, null));
|
|
263
|
-
}
|
|
264
|
-
// 试看接口失败
|
|
265
|
-
if (errorKey) {
|
|
266
|
-
return /*#__PURE__*/React.createElement(UnsupportedView, {
|
|
267
|
-
tipKey: errorKey,
|
|
268
|
-
downloadUrl: item.url,
|
|
269
|
-
onViewFull: onViewFull
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
// 试看地址
|
|
273
|
-
return trialUrl ? /*#__PURE__*/React.createElement("iframe", {
|
|
168
|
+
// item.url 即试看地址:Office 文档用 Office 在线预览嵌入地址;Web 类型(pdf/图片)直接用 url
|
|
169
|
+
var isOfficeType = SUPPORT_PREVIEW_FILE_TYPE.includes(item.suffix);
|
|
170
|
+
var previewUrl = isOfficeType ? "https://view.officeapps.live.com/op/embed.aspx?src=".concat(encodeURIComponent(item.url)) : item.url;
|
|
171
|
+
return /*#__PURE__*/React.createElement("iframe", {
|
|
274
172
|
className: styles.docFrame,
|
|
275
|
-
src:
|
|
173
|
+
src: previewUrl,
|
|
276
174
|
style: {
|
|
277
175
|
border: 0
|
|
278
176
|
},
|
|
279
177
|
title: item.name || t('file.previewTitle')
|
|
280
|
-
})
|
|
178
|
+
});
|
|
281
179
|
};
|
|
282
|
-
var NewsPlayer = function NewsPlayer(
|
|
180
|
+
var NewsPlayer = function NewsPlayer(_ref6) {
|
|
283
181
|
var _item$regulationType;
|
|
284
|
-
var item =
|
|
182
|
+
var item = _ref6.item;
|
|
285
183
|
var _useTranslation3 = useTranslation(),
|
|
286
184
|
t = _useTranslation3.t;
|
|
287
185
|
var html = item.htmlContent || item.content || '';
|
|
@@ -330,12 +228,12 @@ var NewsPlayer = function NewsPlayer(_ref8) {
|
|
|
330
228
|
className: styles.newsMaskText
|
|
331
229
|
}, t('trace.information.unsupportedTips')))));
|
|
332
230
|
};
|
|
333
|
-
var TryWatch = function TryWatch(
|
|
334
|
-
var item =
|
|
335
|
-
type =
|
|
336
|
-
visible =
|
|
337
|
-
onCancel =
|
|
338
|
-
onCurrentTraceVideoClick =
|
|
231
|
+
var TryWatch = function TryWatch(_ref7) {
|
|
232
|
+
var item = _ref7.item,
|
|
233
|
+
type = _ref7.type,
|
|
234
|
+
visible = _ref7.visible,
|
|
235
|
+
onCancel = _ref7.onCancel,
|
|
236
|
+
onCurrentTraceVideoClick = _ref7.onCurrentTraceVideoClick;
|
|
339
237
|
var platform = useAppSelector(function (state) {
|
|
340
238
|
return state.gimiMenu.platform;
|
|
341
239
|
});
|
|
@@ -4,6 +4,7 @@ import styles from "./imageFile.module.css";
|
|
|
4
4
|
import { FileStatus } from "../../interfaces/fileInterface";
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import IconFontCom from "../iconfont-com";
|
|
7
|
+
import AiLoading from "../ai-loading";
|
|
7
8
|
var ImageFile = function ImageFile(_ref) {
|
|
8
9
|
var file = _ref.file,
|
|
9
10
|
handleDelFile = _ref.handleDelFile,
|
|
@@ -48,9 +49,9 @@ var ImageFile = function ImageFile(_ref) {
|
|
|
48
49
|
}
|
|
49
50
|
}), isLoading && /*#__PURE__*/React.createElement("div", {
|
|
50
51
|
className: styles.uploadLoading
|
|
51
|
-
}, /*#__PURE__*/React.createElement(
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
}, /*#__PURE__*/React.createElement(AiLoading, {
|
|
53
|
+
size: [20, 30],
|
|
54
|
+
hiddenTitle: true
|
|
54
55
|
})), isError && /*#__PURE__*/React.createElement("div", {
|
|
55
56
|
className: styles.uploadError,
|
|
56
57
|
onClick: handleRetryClick
|
|
@@ -43,7 +43,7 @@ var enUS = {
|
|
|
43
43
|
'trace.document.total': '{{count}} documents in this conversation',
|
|
44
44
|
'trace.document.unsupported': 'This file type cannot be previewed',
|
|
45
45
|
'trace.document.unsupportedTips': 'This file format does not support trial preview. You can download it and view it with other software.\nTo view the full document, click the "View" button.',
|
|
46
|
-
'trace.video.unsupportedTips': 'This video does not support trial preview
|
|
46
|
+
'trace.video.unsupportedTips': 'This video does not support trial preview.\nTo view the full video, click the "View" button.',
|
|
47
47
|
'trace.information.unsupportedTips': 'The following content is not available for trial preview',
|
|
48
48
|
'trace.notPermission': 'No access rights',
|
|
49
49
|
'trace.tryWatchVideo': 'Video',
|
|
@@ -43,7 +43,7 @@ var zhCN = {
|
|
|
43
43
|
'trace.document.total': '本对话共{{count}}个文档',
|
|
44
44
|
'trace.document.unsupported': '当前文件不支持预览',
|
|
45
45
|
'trace.document.unsupportedTips': '文件格式不支持试看,您可以下载后用其他软件查看。\n如需查看完整文档,请点击“去查看”按钮。',
|
|
46
|
-
'trace.video.unsupportedTips': '
|
|
46
|
+
'trace.video.unsupportedTips': '该视频暂不支持试看,\n如需查看完整视频,请点击“去查看”按钮。',
|
|
47
47
|
'trace.information.unsupportedTips': '以下内容暂不可试看',
|
|
48
48
|
'trace.notPermission': '暂无权益',
|
|
49
49
|
'trace.tryWatchVideo': '视频',
|