@myun/gimi-chat 0.9.11 → 0.9.12
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/answer-item/index.js +13 -0
- package/dist/components/custom-render/WordCard.d.ts +8 -0
- package/dist/components/custom-render/WordCard.js +62 -0
- package/dist/components/excel-components/ExcelSuccessCard.js +1 -1
- package/dist/components/file-card/index.d.ts +2 -0
- package/dist/components/file-card/index.js +14 -5
- 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
|
@@ -10,6 +10,7 @@ import WorkFlowContent from "../work-flow-content";
|
|
|
10
10
|
import ExcelSuccessCard from "../excel-components/ExcelSuccessCard";
|
|
11
11
|
import KnowledgeIconGroup from "../knowledge-trace/KnowledgeIconComponent";
|
|
12
12
|
import ExcelCard from "../excel-components/ExcelCard";
|
|
13
|
+
import WordCard from "../custom-render/WordCard";
|
|
13
14
|
import { IconTickCircle } from '@douyinfe/semi-icons';
|
|
14
15
|
import VoicePlay from "../message-actions/VoicePlay";
|
|
15
16
|
import { useAppSelector } from "../../store/hooks";
|
|
@@ -111,6 +112,18 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
111
112
|
value: newVal
|
|
112
113
|
});
|
|
113
114
|
}
|
|
115
|
+
}, {
|
|
116
|
+
type: 'word',
|
|
117
|
+
component: function component(value) {
|
|
118
|
+
var newVal = {
|
|
119
|
+
content: value.value,
|
|
120
|
+
onDownloadCallback: onDownloadCallback,
|
|
121
|
+
model: model
|
|
122
|
+
};
|
|
123
|
+
return /*#__PURE__*/React.createElement(WordCard, {
|
|
124
|
+
value: newVal
|
|
125
|
+
});
|
|
126
|
+
}
|
|
114
127
|
}, {
|
|
115
128
|
type: 'knowledge',
|
|
116
129
|
component: function component(value) {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { FileCard, MultipleFileCard } from "../file-card";
|
|
4
|
+
var transforata = function transforata(data, t) {
|
|
5
|
+
var fileName = data.fileName || t('excel.defaultFileName') + '.docx';
|
|
6
|
+
var size = data.size || '0.0KB';
|
|
7
|
+
var downloadUrl = data.fileAddr || '';
|
|
8
|
+
var tempArr = fileName.split('.');
|
|
9
|
+
var fileType = (tempArr === null || tempArr === void 0 ? void 0 : tempArr.length) > 1 ? tempArr.pop() : 'docx';
|
|
10
|
+
return {
|
|
11
|
+
fileName: fileName,
|
|
12
|
+
fileType: fileType,
|
|
13
|
+
size: size,
|
|
14
|
+
downloadUrl: downloadUrl
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
var WordCard = function WordCard(_ref) {
|
|
18
|
+
var _detail, _detail2;
|
|
19
|
+
var value = _ref.value;
|
|
20
|
+
var _useTranslation = useTranslation(),
|
|
21
|
+
t = _useTranslation.t;
|
|
22
|
+
var _ref2 = value || {},
|
|
23
|
+
content = _ref2.content,
|
|
24
|
+
onDownloadCallback = _ref2.onDownloadCallback,
|
|
25
|
+
model = _ref2.model;
|
|
26
|
+
var detail = {};
|
|
27
|
+
try {
|
|
28
|
+
detail = typeof content === 'string' ? JSON.parse(content) : content;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error(error);
|
|
31
|
+
return content;
|
|
32
|
+
}
|
|
33
|
+
if (((_detail = detail) === null || _detail === void 0 ? void 0 : _detail.code) !== 0) return content;
|
|
34
|
+
var skillDetail = ((_detail2 = detail) === null || _detail2 === void 0 || (_detail2 = _detail2.data) === null || _detail2 === void 0 ? void 0 : _detail2.list) || [];
|
|
35
|
+
if (Array.isArray(skillDetail)) {
|
|
36
|
+
var renderData = skillDetail.map(function (item) {
|
|
37
|
+
return transforata(item, t);
|
|
38
|
+
});
|
|
39
|
+
return /*#__PURE__*/React.createElement(MultipleFileCard, {
|
|
40
|
+
list: renderData,
|
|
41
|
+
onDownloadCallback: onDownloadCallback,
|
|
42
|
+
model: model,
|
|
43
|
+
showAll: true
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
var _transforata = transforata(skillDetail, t),
|
|
47
|
+
fileName = _transforata.fileName,
|
|
48
|
+
downloadUrl = _transforata.downloadUrl,
|
|
49
|
+
size = _transforata.size,
|
|
50
|
+
fileType = _transforata.fileType;
|
|
51
|
+
return /*#__PURE__*/React.createElement(FileCard, {
|
|
52
|
+
fileName: fileName,
|
|
53
|
+
fileType: fileType,
|
|
54
|
+
size: size,
|
|
55
|
+
downloadUrl: downloadUrl,
|
|
56
|
+
downloadText: t('excel.download'),
|
|
57
|
+
onDownloadCallback: onDownloadCallback,
|
|
58
|
+
model: model,
|
|
59
|
+
disablePreview: true
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export default WordCard;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { FileCard, MultipleFileCard } from "../file-card";
|
|
4
4
|
var transforata = function transforata(data, t) {
|
|
5
|
-
var fileName = data.file_name || t('excel.defaultFileName');
|
|
5
|
+
var fileName = data.file_name || t('excel.defaultFileName') + '.xlsx';
|
|
6
6
|
var size = data.size || '0.0KB';
|
|
7
7
|
var downloadUrl = data.result_url || '';
|
|
8
8
|
var tempArr = fileName.split('.');
|
|
@@ -9,10 +9,12 @@ export interface IFileCardProps {
|
|
|
9
9
|
export declare const FileCard: React.FC<IFileCardProps & {
|
|
10
10
|
downloadText?: string;
|
|
11
11
|
model: 'fullscreen' | 'sidebar';
|
|
12
|
+
disablePreview?: boolean;
|
|
12
13
|
}>;
|
|
13
14
|
export declare const MultipleFileCard: React.FC<{
|
|
14
15
|
list: IFileCardProps[];
|
|
15
16
|
onDownloadCallback?: () => void;
|
|
16
17
|
model: 'fullscreen' | 'sidebar';
|
|
18
|
+
showAll?: boolean;
|
|
17
19
|
}>;
|
|
18
20
|
export default MultipleFileCard;
|
|
@@ -14,16 +14,23 @@ export var FileCard = function FileCard(_ref) {
|
|
|
14
14
|
fileType = _ref.fileType,
|
|
15
15
|
downloadText = _ref.downloadText,
|
|
16
16
|
onDownloadCallback = _ref.onDownloadCallback,
|
|
17
|
-
model = _ref.model
|
|
17
|
+
model = _ref.model,
|
|
18
|
+
_ref$disablePreview = _ref.disablePreview,
|
|
19
|
+
disablePreview = _ref$disablePreview === void 0 ? false : _ref$disablePreview;
|
|
18
20
|
var _useTranslation = useTranslation(),
|
|
19
21
|
t = _useTranslation.t;
|
|
20
22
|
var dispatch = useAppDispatch();
|
|
23
|
+
var fileImgMap = {
|
|
24
|
+
"docx": "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202604/22/2fe5c_20260422110615.png",
|
|
25
|
+
"xlsx": "https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202512/19/b8723_20251219094824.png"
|
|
26
|
+
};
|
|
21
27
|
var handleDownLoad = function handleDownLoad(_event) {
|
|
22
28
|
_event.stopPropagation();
|
|
23
|
-
downloadExcelByUrl(downloadUrl, decodeURIComponent(fileName) || t('file.defaultFileName'));
|
|
29
|
+
downloadExcelByUrl(downloadUrl, decodeURIComponent(fileName) || t('file.defaultFileName') + '.' + fileType);
|
|
24
30
|
onDownloadCallback === null || onDownloadCallback === void 0 || onDownloadCallback();
|
|
25
31
|
};
|
|
26
32
|
var previewExcel = function previewExcel() {
|
|
33
|
+
if (disablePreview) return;
|
|
27
34
|
if (model === 'sidebar') {
|
|
28
35
|
window.open("https://view.officeapps.live.com/op/embed.aspx?src=".concat(encodeURIComponent(downloadUrl)), '_blank');
|
|
29
36
|
return;
|
|
@@ -42,7 +49,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
42
49
|
}, /*#__PURE__*/React.createElement("div", {
|
|
43
50
|
className: styles.icon
|
|
44
51
|
}, /*#__PURE__*/React.createElement("img", {
|
|
45
|
-
src:
|
|
52
|
+
src: fileImgMap[fileType] || fileImgMap['xlsx'],
|
|
46
53
|
alt: ""
|
|
47
54
|
})), /*#__PURE__*/React.createElement("div", {
|
|
48
55
|
className: styles.left
|
|
@@ -72,12 +79,14 @@ export var FileCard = function FileCard(_ref) {
|
|
|
72
79
|
export var MultipleFileCard = function MultipleFileCard(_ref2) {
|
|
73
80
|
var list = _ref2.list,
|
|
74
81
|
onDownloadCallback = _ref2.onDownloadCallback,
|
|
75
|
-
model = _ref2.model
|
|
82
|
+
model = _ref2.model,
|
|
83
|
+
_ref2$showAll = _ref2.showAll,
|
|
84
|
+
showAll = _ref2$showAll === void 0 ? false : _ref2$showAll;
|
|
76
85
|
var dispatch = useAppDispatch();
|
|
77
86
|
var _useTranslation2 = useTranslation(),
|
|
78
87
|
t = _useTranslation2.t;
|
|
79
88
|
var renderList = [];
|
|
80
|
-
var hasMore = (list === null || list === void 0 ? void 0 : list.length) > 2;
|
|
89
|
+
var hasMore = !showAll && (list === null || list === void 0 ? void 0 : list.length) > 2;
|
|
81
90
|
if (hasMore) {
|
|
82
91
|
renderList = list.slice(0, 2);
|
|
83
92
|
} else {
|
|
@@ -193,7 +193,7 @@ var enUS = {
|
|
|
193
193
|
'excel.finishing': 'Analysis complete. Result is being generated and prepared for presentation...',
|
|
194
194
|
'excel.finished': 'Analysis complete. Result is being generated and prepared for presentation',
|
|
195
195
|
'excel.retry': 'Retry',
|
|
196
|
-
'excel.defaultFileName': 'Download
|
|
196
|
+
'excel.defaultFileName': 'Download',
|
|
197
197
|
'excel.download': 'Download',
|
|
198
198
|
// AI Chat Dialogue
|
|
199
199
|
'aiDialogue.newConversation': 'New Chat',
|
|
@@ -193,7 +193,7 @@ var zhCN = {
|
|
|
193
193
|
'excel.finishing': '分析完成,结果载体即将生成,正准备呈现...',
|
|
194
194
|
'excel.finished': '分析完成,结果载体即将生成,正在准备呈现',
|
|
195
195
|
'excel.retry': '重试',
|
|
196
|
-
'excel.defaultFileName': '
|
|
196
|
+
'excel.defaultFileName': '文件下载',
|
|
197
197
|
'excel.download': '下载',
|
|
198
198
|
// AI Chat Dialogue
|
|
199
199
|
'aiDialogue.newConversation': '新对话',
|