@myun/gimi-chat 0.9.6 → 0.9.8

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.
Files changed (83) hide show
  1. package/dist/client/components/history-list/index.js +14 -11
  2. package/dist/client/components/slider/index.js +5 -2
  3. package/dist/client/core/index.js +6 -2
  4. package/dist/components/ai-chat-dialogue/index.js +26 -23
  5. package/dist/components/ai-loading/index.js +4 -1
  6. package/dist/components/answer-item/index.js +7 -4
  7. package/dist/components/ask-card/index.js +5 -2
  8. package/dist/components/ask-card/index.module.css +8 -1
  9. package/dist/components/chat-input/index.js +29 -25
  10. package/dist/components/chat-voice/VoiceCommunication.js +6 -4
  11. package/dist/components/chat-voice/VoiceRecord.js +6 -3
  12. package/dist/components/conversation-delete/index.js +5 -2
  13. package/dist/components/excel-components/ExcelExcuting.js +28 -23
  14. package/dist/components/excel-components/ExcelFailCard.js +4 -1
  15. package/dist/components/excel-components/ExcelSuccessCard.js +8 -5
  16. package/dist/components/excel-components/index.module.css +1 -1
  17. package/dist/components/file-card/fileCardSidebar.js +7 -2
  18. package/dist/components/file-card/index.js +10 -5
  19. package/dist/components/file-card/index.module.css +3 -1
  20. package/dist/components/file-upload/index.js +15 -7
  21. package/dist/components/file-upload/uploadV1.js +15 -8
  22. package/dist/components/knowledge-trace/KnowledgeIconComponent.js +10 -2
  23. package/dist/components/knowledge-trace/classList.js +11 -4
  24. package/dist/components/knowledge-trace/documentList.js +11 -4
  25. package/dist/components/knowledge-trace/index.js +6 -3
  26. package/dist/components/knowledge-trace/index.module.css +6 -3
  27. package/dist/components/knowledge-trace/videoList.js +16 -6
  28. package/dist/components/message-actions/CopyButton.js +4 -1
  29. package/dist/components/message-actions/LikeButton.js +4 -1
  30. package/dist/components/message-actions/RegenerateButton.js +5 -2
  31. package/dist/components/message-actions/UnLikeButton.js +4 -1
  32. package/dist/components/message-actions/VoicePlay.js +6 -2
  33. package/dist/components/no-microphone-root/index.js +9 -7
  34. package/dist/components/no-microphone-root/index.module.css +10 -1
  35. package/dist/components/product-tag/index.js +10 -7
  36. package/dist/components/quoted-content/index.js +17 -12
  37. package/dist/components/reasoning-content/index.js +8 -5
  38. package/dist/components/reasoning-search/index.d.ts +1 -1
  39. package/dist/components/reasoning-search/index.js +15 -6
  40. package/dist/components/reference-content/index.js +10 -3
  41. package/dist/components/search-course-list/index.js +13 -6
  42. package/dist/components/search-course-list/index.module.css +6 -3
  43. package/dist/components/search-course-list/sidebar.js +7 -2
  44. package/dist/components/templates/GimiChatComponent.js +5 -1
  45. package/dist/components/unified-sidebar/FileListContent.js +8 -2
  46. package/dist/components/unified-sidebar/KnowledgeTraceContent.d.ts +1 -0
  47. package/dist/components/unified-sidebar/KnowledgeTraceContent.js +33 -3
  48. package/dist/components/unified-sidebar/SearchCourseListContent.js +8 -4
  49. package/dist/components/unified-sidebar/index.js +14 -8
  50. package/dist/components/upload-list/index.js +6 -3
  51. package/dist/components/voice-recording/index.js +10 -7
  52. package/dist/components/work-flow-content/index.js +7 -1
  53. package/dist/hooks/useChatActions.js +9 -6
  54. package/dist/hooks/useChatHistory.js +4 -1
  55. package/dist/hooks/useChatRecommend.js +7 -4
  56. package/dist/hooks/useChatStream.js +12 -2
  57. package/dist/hooks/useChatVoice.js +12 -6
  58. package/dist/hooks/useCommonChatAPI.js +25 -21
  59. package/dist/hooks/useFile.js +14 -9
  60. package/dist/hooks/useLongPoll.js +5 -2
  61. package/dist/hooks/useSearchCase.js +5 -2
  62. package/dist/i18n/GimiChatI18nProvider.d.ts +9 -0
  63. package/dist/i18n/GimiChatI18nProvider.js +25 -0
  64. package/dist/i18n/core.d.ts +12 -0
  65. package/dist/i18n/core.js +71 -0
  66. package/dist/i18n/index.d.ts +4 -0
  67. package/dist/i18n/index.js +3 -0
  68. package/dist/i18n/locales/en-US.d.ts +216 -0
  69. package/dist/i18n/locales/en-US.js +242 -0
  70. package/dist/i18n/locales/zh-CN.d.ts +216 -0
  71. package/dist/i18n/locales/zh-CN.js +242 -0
  72. package/dist/i18n/useGimiChatTranslation.d.ts +2 -0
  73. package/dist/i18n/useGimiChatTranslation.js +5 -0
  74. package/dist/index.d.ts +1 -0
  75. package/dist/index.js +1 -0
  76. package/dist/types/chat.d.ts +4 -1
  77. package/dist/types/modules.d.ts +1 -0
  78. package/dist/umd/index.min.js +1 -1
  79. package/dist/utils/tools.d.ts +1 -1
  80. package/dist/utils/tools.js +5 -5
  81. package/dist/utils/voice-stream.d.ts +2 -0
  82. package/dist/utils/voice-stream.js +43 -20
  83. package/package.json +6 -4
@@ -7,9 +7,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React from 'react';
8
8
  import { Toast, Tooltip } from '@douyinfe/semi-ui';
9
9
  // import useVoiceFirstUse from '@/hooks/useVoiceFirstUse';
10
-
10
+ import { useTranslation } from 'react-i18next';
11
11
  var ICON_ADDRESS = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/12/0812c_20260112171004.png';
12
12
  var VoiceCommunication = function VoiceCommunication(props) {
13
+ var _useTranslation = useTranslation(),
14
+ t = _useTranslation.t;
13
15
  var _React$useState = React.useState(false),
14
16
  _React$useState2 = _slicedToArray(_React$useState, 2),
15
17
  showToast = _React$useState2[0],
@@ -35,13 +37,13 @@ var VoiceCommunication = function VoiceCommunication(props) {
35
37
  }, [isVoiceCallFirstUse]);
36
38
  var handleClick = function handleClick() {
37
39
  if (props.disabled) {
38
- Toast.warning('当前流程不支持语音通话');
40
+ Toast.warning(t('voice.callUnsupported'));
39
41
  return;
40
42
  }
41
43
  props.onClick();
42
44
  };
43
45
  return /*#__PURE__*/React.createElement(Tooltip, {
44
- content: '语音通话',
46
+ content: t('voice.callAlt'),
45
47
  visible: showToast,
46
48
  onVisibleChange: function onVisibleChange(isVisible) {
47
49
  return setShowToast(isVisible);
@@ -63,7 +65,7 @@ var VoiceCommunication = function VoiceCommunication(props) {
63
65
  height: '32px'
64
66
  },
65
67
  src: ICON_ADDRESS,
66
- alt: "\u8BED\u97F3\u901A\u8BDD"
68
+ alt: t('voice.callAlt')
67
69
  })));
68
70
  };
69
71
  export default VoiceCommunication;
@@ -1,16 +1,19 @@
1
1
  import React from 'react';
2
2
  import { Tooltip, Toast } from '@douyinfe/semi-ui';
3
+ import { useTranslation } from 'react-i18next';
3
4
  var ICON_ADDRESS = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/04/be8de_20260104155638.png';
4
5
  var VoiceRecord = function VoiceRecord(props) {
6
+ var _useTranslation = useTranslation(),
7
+ t = _useTranslation.t;
5
8
  var handleClick = function handleClick() {
6
9
  if (props.disabled) {
7
- Toast.warning('当前流程不支持语音输入');
10
+ Toast.warning(t('voice.inputUnsupported'));
8
11
  return;
9
12
  }
10
13
  props.onClick();
11
14
  };
12
15
  return /*#__PURE__*/React.createElement(Tooltip, {
13
- content: '语音输入'
16
+ content: t('voice.inputAlt')
14
17
  }, /*#__PURE__*/React.createElement("div", {
15
18
  style: {
16
19
  display: 'flex',
@@ -28,7 +31,7 @@ var VoiceRecord = function VoiceRecord(props) {
28
31
  height: '32px'
29
32
  },
30
33
  src: ICON_ADDRESS,
31
- alt: "\u8BED\u97F3\u8F93\u5165"
34
+ alt: t('voice.inputAlt')
32
35
  })));
33
36
  };
34
37
  export default VoiceRecord;
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
2
3
  import { Popconfirm, Button } from '@douyinfe/semi-ui';
3
4
  import { IconDeleteStroked } from '@douyinfe/semi-icons';
4
5
  var ConversationDelete = function ConversationDelete(_ref) {
5
6
  var onDelete = _ref.onDelete;
7
+ var _useTranslation = useTranslation(),
8
+ t = _useTranslation.t;
6
9
  var onConfirm = function onConfirm() {
7
10
  onDelete();
8
11
  };
@@ -10,8 +13,8 @@ var ConversationDelete = function ConversationDelete(_ref) {
10
13
  // 取消删除
11
14
  };
12
15
  return /*#__PURE__*/React.createElement(Popconfirm, {
13
- title: "\u786E\u5B9A\u662F\u5426\u8981\u5220\u9664\u4F1A\u8BDD\uFF1F",
14
- content: "\u6B64\u64CD\u4F5C\u5C06\u4E0D\u53EF\u9006",
16
+ title: t('conversationDelete.title'),
17
+ content: t('conversationDelete.content'),
15
18
  onConfirm: onConfirm,
16
19
  onCancel: onCancel
17
20
  }, /*#__PURE__*/React.createElement(Button, {
@@ -15,36 +15,41 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
15
15
  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; } }
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import React from "react";
18
+ import { useTranslation } from 'react-i18next';
18
19
  import { IconTickCircle } from "@douyinfe/semi-icons";
19
20
  import styles from "./styles.module.css";
20
21
  import LoadingIcon from "../../assets/image/Subtract.png";
21
22
  import classNames from "classnames";
22
23
  import { useExcelExcuteLongPoll } from "../../hooks/useLongPoll";
23
24
  import LoadingDots from "../../components/dots-loading";
24
- var MOCK_STEPS = [{
25
- id: 1,
26
- text: "启动核心分析模块"
27
- }, {
28
- id: 2,
29
- text: "解析关键要素"
30
- }, {
31
- id: 3,
32
- text: "构建多场景解法"
33
- }, {
34
- id: 4,
35
- text: "评估执行策略"
36
- }, {
37
- id: 5,
38
- text: "确定最优路径"
39
- }, {
40
- id: 6,
41
- text: "输出结果载体生成中"
42
- }];
43
25
  export var ExcelExcutingSteps = function ExcelExcutingSteps(_ref) {
44
26
  var item = _ref.item,
45
27
  skillDetail = _ref.skillDetail,
46
28
  onSucess = _ref.onSucess,
47
29
  onFailure = _ref.onFailure;
30
+ var _useTranslation = useTranslation(),
31
+ t = _useTranslation.t;
32
+ var MOCK_STEPS = React.useMemo(function () {
33
+ return [{
34
+ id: 1,
35
+ text: t('excel.steps.start')
36
+ }, {
37
+ id: 2,
38
+ text: t('excel.steps.parse')
39
+ }, {
40
+ id: 3,
41
+ text: t('excel.steps.build')
42
+ }, {
43
+ id: 4,
44
+ text: t('excel.steps.evaluate')
45
+ }, {
46
+ id: 5,
47
+ text: t('excel.steps.determine')
48
+ }, {
49
+ id: 6,
50
+ text: t('excel.steps.generate')
51
+ }];
52
+ }, [t]);
48
53
  var requestId = skillDetail.requestId;
49
54
  var _React$useState = React.useState([]),
50
55
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -227,9 +232,9 @@ export var ExcelExcutingSteps = function ExcelExcutingSteps(_ref) {
227
232
  className: styles.header
228
233
  }, !onReady && /*#__PURE__*/React.createElement("h3", {
229
234
  className: styles.title
230
- }, /*#__PURE__*/React.createElement(LoadingDots, null), '正在分析与生成模版...'), /*#__PURE__*/React.createElement("p", {
235
+ }, /*#__PURE__*/React.createElement(LoadingDots, null), t('excel.analyzing')), /*#__PURE__*/React.createElement("p", {
231
236
  className: styles.description
232
- }, '正在启动任务处理流程, 结合上下文信息, 系统已进入深度分析阶段, 请稍候5~10分钟。')), /*#__PURE__*/React.createElement("div", {
237
+ }, t('excel.analyzingDesc'))), /*#__PURE__*/React.createElement("div", {
233
238
  className: styles.stepsContainer
234
239
  }, renderSteps.map(function (step) {
235
240
  return /*#__PURE__*/React.createElement("div", {
@@ -255,9 +260,9 @@ export var ExcelExcutingSteps = function ExcelExcutingSteps(_ref) {
255
260
  }, step.text)));
256
261
  })), onReady && /*#__PURE__*/React.createElement("span", {
257
262
  className: styles.finishText
258
- }, "\u5206\u6790\u5B8C\u6210\uFF0C\u7ED3\u679C\u8F7D\u4F53\u5373\u5C06\u751F\u6210\uFF0C\u6B63\u51C6\u5907\u5448\u73B0...")) : /*#__PURE__*/React.createElement("div", {
263
+ }, t('excel.finishing'))) : /*#__PURE__*/React.createElement("div", {
259
264
  className: classNames(styles.contentWrapper)
260
265
  }, /*#__PURE__*/React.createElement("h3", {
261
266
  className: styles.title
262
- }, "\u5206\u6790\u5B8C\u6210\uFF0C\u7ED3\u679C\u8F7D\u4F53\u5373\u5C06\u751F\u6210\uFF0C\u6B63\u5728\u51C6\u5907\u5448\u73B0"))));
267
+ }, t('excel.finished')))));
263
268
  };
@@ -1,10 +1,13 @@
1
1
  import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
2
3
  import styles from "./index.module.css";
3
4
  import classNames from 'classnames';
4
5
  var ExcelFailCard = function ExcelFailCard(_ref) {
5
6
  var item = _ref.item,
6
7
  skillDetail = _ref.skillDetail,
7
8
  onRetry = _ref.onRetry;
9
+ var _useTranslation = useTranslation(),
10
+ t = _useTranslation.t;
8
11
  var message = skillDetail.message;
9
12
  return /*#__PURE__*/React.createElement("div", {
10
13
  className: styles.excelFail
@@ -15,6 +18,6 @@ var ExcelFailCard = function ExcelFailCard(_ref) {
15
18
  onClick: function onClick() {
16
19
  return onRetry(skillDetail, item === null || item === void 0 ? void 0 : item.id);
17
20
  }
18
- }, "\u91CD\u8BD5"));
21
+ }, t('excel.retry')));
19
22
  };
20
23
  export default ExcelFailCard;
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
+ import { useTranslation } from 'react-i18next';
2
3
  import { FileCard, MultipleFileCard } from "../file-card";
3
- var transforata = function transforata(data) {
4
- var fileName = data.file_name || '文件下载.xlsx';
4
+ var transforata = function transforata(data, t) {
5
+ var fileName = data.file_name || t('excel.defaultFileName');
5
6
  var size = data.size || '0.0KB';
6
7
  var downloadUrl = data.result_url || '';
7
8
  var tempArr = fileName.split('.');
@@ -15,6 +16,8 @@ var transforata = function transforata(data) {
15
16
  };
16
17
  var ExcelSuccessCard = function ExcelSuccessCard(_ref) {
17
18
  var value = _ref.value;
19
+ var _useTranslation = useTranslation(),
20
+ t = _useTranslation.t;
18
21
  var _ref2 = value || {},
19
22
  content = _ref2.content,
20
23
  onDownloadCallback = _ref2.onDownloadCallback,
@@ -30,7 +33,7 @@ var ExcelSuccessCard = function ExcelSuccessCard(_ref) {
30
33
  // 新天工数据格式
31
34
  if (Array.isArray(skillDetail)) {
32
35
  var renderData = skillDetail.map(function (item) {
33
- return transforata(item);
36
+ return transforata(item, t);
34
37
  });
35
38
  return /*#__PURE__*/React.createElement(MultipleFileCard, {
36
39
  list: renderData,
@@ -40,7 +43,7 @@ var ExcelSuccessCard = function ExcelSuccessCard(_ref) {
40
43
  }
41
44
 
42
45
  // 老天工数据格式
43
- var _transforata = transforata(skillDetail),
46
+ var _transforata = transforata(skillDetail, t),
44
47
  fileName = _transforata.fileName,
45
48
  downloadUrl = _transforata.downloadUrl,
46
49
  size = _transforata.size,
@@ -50,7 +53,7 @@ var ExcelSuccessCard = function ExcelSuccessCard(_ref) {
50
53
  fileType: fileType,
51
54
  size: size,
52
55
  downloadUrl: downloadUrl,
53
- downloadText: "\u4E0B\u8F7D",
56
+ downloadText: t('excel.download'),
54
57
  onDownloadCallback: onDownloadCallback,
55
58
  model: model
56
59
  });
@@ -1,6 +1,6 @@
1
1
  @charset "UTF-8";
2
2
  .excelSucess {
3
- width: 328px;
3
+ width: 340px;
4
4
  flex-shrink: 0;
5
5
  border-radius: 12px;
6
6
  border: 1px solid var(---, #e9ebf2);
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
2
3
  import GimiSideBar from "../gimi-sidebar";
3
4
  import { useAppSelector, useAppDispatch } from "../../store/hooks";
4
5
  import { setShowSidebarFileList, setSidebarFileList } from "../../store/slices/gimiMenuSlice";
@@ -6,6 +7,8 @@ import { useCallback } from "react";
6
7
  import styles from "./index.module.css";
7
8
  import { FileCard } from ".";
8
9
  var FileCardSideBar = function FileCardSideBar(props) {
10
+ var _useTranslation = useTranslation(),
11
+ t = _useTranslation.t;
9
12
  var sidebarTargetElm = props.sidebarTargetElm,
10
13
  isOverFlow = props.isOverFlow,
11
14
  className = props.className,
@@ -26,7 +29,7 @@ var FileCardSideBar = function FileCardSideBar(props) {
26
29
  return /*#__PURE__*/React.createElement(GimiSideBar, {
27
30
  show: showSidebar,
28
31
  isOverFlow: isOverFlow,
29
- title: "\u5168\u90E8",
32
+ title: t('sidebar.fileList'),
30
33
  handleClose: handleClose,
31
34
  className: className,
32
35
  style: style,
@@ -35,7 +38,9 @@ var FileCardSideBar = function FileCardSideBar(props) {
35
38
  className: styles.list
36
39
  }, /*#__PURE__*/React.createElement("span", {
37
40
  className: styles.total
38
- }, "\u672C\u5BF9\u8BDD\u5171".concat((fileList === null || fileList === void 0 ? void 0 : fileList.length) || 0, "\u4E2A\u6587\u6863")), fileList.map(function (file, index) {
41
+ }, t('file.totalInConversation', {
42
+ count: (fileList === null || fileList === void 0 ? void 0 : fileList.length) || 0
43
+ })), fileList.map(function (file, index) {
39
44
  return /*#__PURE__*/React.createElement(FileCard, {
40
45
  fileName: file.fileName,
41
46
  fileType: file.fileType,
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Tooltip } from '@douyinfe/semi-ui';
3
+ import { useTranslation } from 'react-i18next';
3
4
  import styles from "./index.module.css";
4
5
  import { downloadExcelByUrl } from "../../utils/tools";
5
6
  import { useAppDispatch } from "../../store/hooks";
@@ -14,10 +15,12 @@ export var FileCard = function FileCard(_ref) {
14
15
  downloadText = _ref.downloadText,
15
16
  onDownloadCallback = _ref.onDownloadCallback,
16
17
  model = _ref.model;
18
+ var _useTranslation = useTranslation(),
19
+ t = _useTranslation.t;
17
20
  var dispatch = useAppDispatch();
18
21
  var handleDownLoad = function handleDownLoad(_event) {
19
22
  _event.stopPropagation();
20
- downloadExcelByUrl(downloadUrl, decodeURIComponent(fileName));
23
+ downloadExcelByUrl(downloadUrl, decodeURIComponent(fileName) || t('file.defaultFileName'));
21
24
  onDownloadCallback === null || onDownloadCallback === void 0 || onDownloadCallback();
22
25
  };
23
26
  var previewExcel = function previewExcel() {
@@ -29,7 +32,7 @@ export var FileCard = function FileCard(_ref) {
29
32
  filePreviewState: {
30
33
  show: true,
31
34
  url: downloadUrl,
32
- filename: fileName
35
+ filename: fileName || t('file.defaultFileName')
33
36
  }
34
37
  }));
35
38
  };
@@ -59,7 +62,7 @@ export var FileCard = function FileCard(_ref) {
59
62
  }, downloadText && /*#__PURE__*/React.createElement("span", {
60
63
  className: styles.text
61
64
  }, downloadText), /*#__PURE__*/React.createElement(Tooltip, {
62
- content: '下载'
65
+ content: t('file.download')
63
66
  }, /*#__PURE__*/React.createElement("img", {
64
67
  src: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202509/15/c61c4_20250915193545.png",
65
68
  width: 20,
@@ -71,6 +74,8 @@ export var MultipleFileCard = function MultipleFileCard(_ref2) {
71
74
  onDownloadCallback = _ref2.onDownloadCallback,
72
75
  model = _ref2.model;
73
76
  var dispatch = useAppDispatch();
77
+ var _useTranslation2 = useTranslation(),
78
+ t = _useTranslation2.t;
74
79
  var renderList = [];
75
80
  var hasMore = (list === null || list === void 0 ? void 0 : list.length) > 2;
76
81
  if (hasMore) {
@@ -95,13 +100,13 @@ export var MultipleFileCard = function MultipleFileCard(_ref2) {
95
100
  size: item.size,
96
101
  downloadUrl: item.downloadUrl,
97
102
  key: index,
98
- downloadText: "\u4E0B\u8F7D",
103
+ downloadText: t('file.download'),
99
104
  onDownloadCallback: onDownloadCallback,
100
105
  model: model
101
106
  });
102
107
  }), hasMore && /*#__PURE__*/React.createElement("div", {
103
108
  className: styles.all,
104
109
  onClick: openSidebarHandler
105
- }, "\u5168\u90E8", /*#__PURE__*/React.createElement(IconChevronRightStroked, null))));
110
+ }, t('file.viewAll'), /*#__PURE__*/React.createElement(IconChevronRightStroked, null))));
106
111
  };
107
112
  export default MultipleFileCard;
@@ -7,6 +7,7 @@
7
7
  }
8
8
  .main .all {
9
9
  width: 78px;
10
+ min-height: 80px;
10
11
  border-radius: 12px;
11
12
  border: 1px solid rgb(233, 235, 242);
12
13
  display: flex;
@@ -33,12 +34,13 @@
33
34
  }
34
35
 
35
36
  .file_main {
36
- width: 328px;
37
+ width: 340px;
37
38
  flex-shrink: 0;
38
39
  border-radius: 12px;
39
40
  border: 1px solid rgb(233, 235, 242);
40
41
  background: linear-gradient(90deg, #EAF2FF 0%, #FFFFFF 100%);
41
42
  display: flex;
43
+ box-sizing: content-box;
42
44
  align-items: center;
43
45
  gap: 10px;
44
46
  padding: 16px;
@@ -3,6 +3,7 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
3
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
5
  import React from 'react';
6
+ import { useTranslation } from 'react-i18next';
6
7
  import { Upload, Toast, Button } from '@douyinfe/semi-ui';
7
8
  import { IconPaperclip } from '@douyinfe/semi-icons';
8
9
  import { useAppDispatch, useAppSelector } from "../../store/hooks";
@@ -23,6 +24,8 @@ var transformFileItem = function transformFileItem(list) {
23
24
  });
24
25
  };
25
26
  var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
27
+ var _useTranslation = useTranslation(),
28
+ t = _useTranslation.t;
26
29
  var _props$maxSize = props.maxSize,
27
30
  maxSize = _props$maxSize === void 0 ? 10 : _props$maxSize,
28
31
  _props$limit = props.limit,
@@ -85,7 +88,7 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
85
88
  _context.next = 5;
86
89
  break;
87
90
  }
88
- Toast.error('文件读取失败');
91
+ Toast.error(t('upload.readFailed'));
89
92
  return _context.abrupt("return");
90
93
  case 5:
91
94
  // 缓存原始 File
@@ -164,7 +167,7 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
164
167
  _context.next = 40;
165
168
  break;
166
169
  }
167
- Toast.error('网络异常,等待恢复后重试');
170
+ Toast.error(t('upload.networkRetry'));
168
171
  updateFile({
169
172
  uid: file.uid,
170
173
  name: file.name,
@@ -182,7 +185,7 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
182
185
  _context.next = 46;
183
186
  break;
184
187
  }
185
- Toast.error('文件上传失败,已达到最大重试次数');
188
+ Toast.error(t('upload.failedMaxRetry'));
186
189
  updateFile({
187
190
  uid: file.uid,
188
191
  name: file.name,
@@ -195,7 +198,10 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
195
198
  case 46:
196
199
  /** ⏱️ 未达上限,继续重试 */
197
200
  retryCountMapRef.current.set(file.uid, currentRetry + 1);
198
- Toast.warning("\u4E0A\u4F20\u5931\u8D25\uFF0C\u6B63\u5728\u91CD\u8BD5\uFF08".concat(currentRetry + 1, "/").concat(MAX_RETRY_COUNT, "\uFF09"));
201
+ Toast.warning(t('upload.retrying', {
202
+ current: currentRetry + 1,
203
+ total: MAX_RETRY_COUNT
204
+ }));
199
205
  setTimeout(function () {
200
206
  retryUpload(file.uid);
201
207
  }, 1000);
@@ -222,19 +228,21 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
222
228
  var trigger = /*#__PURE__*/React.createElement(Button, {
223
229
  icon: /*#__PURE__*/React.createElement(IconPaperclip, null),
224
230
  type: "tertiary"
225
- }, "\u70B9\u51FB\u4E0A\u4F20");
231
+ }, t('upload.clickToUpload'));
226
232
  return /*#__PURE__*/React.createElement(Upload, {
227
233
  customRequest: customRequest,
228
234
  action: "",
229
235
  limit: limit,
230
236
  onExceed: function onExceed() {
231
- Toast.warning("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(limit, "\u4E2A\u6587\u4EF6"));
237
+ Toast.warning(t('upload.limitExceeded', {
238
+ limit: limit
239
+ }));
232
240
  },
233
241
  multiple: limit > 1,
234
242
  accept: (accept === null || accept === void 0 ? void 0 : accept.join(',')) || DEFAULT_ACCEPT,
235
243
  maxSize: maxSize * 1024,
236
244
  onSizeError: function onSizeError() {
237
- Toast.warning('文件大小超出限制');
245
+ Toast.warning(t('upload.sizeExceeded'));
238
246
  },
239
247
  disabled: disabled,
240
248
  showUploadList: false,
@@ -8,6 +8,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
9
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
10
  import React from 'react';
11
+ import { useTranslation } from 'react-i18next';
11
12
  import { Upload, Toast, Button } from '@douyinfe/semi-ui';
12
13
  import { IconPaperclip } from '@douyinfe/semi-icons';
13
14
  import { FileStatus } from "../../interfaces/fileInterface";
@@ -26,6 +27,8 @@ var transformFileItem = function transformFileItem(item) {
26
27
  });
27
28
  };
28
29
  var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
30
+ var _useTranslation = useTranslation(),
31
+ t = _useTranslation.t;
29
32
  var maxSize = props.maxSize,
30
33
  limit = props.limit,
31
34
  accept = props.accept,
@@ -86,12 +89,14 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
86
89
  });
87
90
  handleSSEFileAnalyize(_objectSpread(_objectSpread({}, pendingFile), responseObj), true);
88
91
  } else {
89
- Toast.error("".concat(currentFile.name, " \u4E0A\u4F20\u5931\u8D25'}"));
92
+ Toast.error(t('upload.fileFailedWithName', {
93
+ name: currentFile.name
94
+ }));
90
95
  }
91
96
  }
92
97
  if (currentFile.status === 'uploadFail') {
93
98
  if (!navigator.onLine) {
94
- Toast.error('无法连接到网络');
99
+ Toast.error(t('common.networkUnavailable'));
95
100
  // 新增:如果当前有正在处理的文件,标记为网络错误
96
101
  var handleOnlineReUpload = function handleOnlineReUpload() {
97
102
  window.removeEventListener('online', handleOnlineReUpload);
@@ -141,7 +146,7 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
141
146
  var defailtTrigger = /*#__PURE__*/React.createElement(Button, {
142
147
  icon: /*#__PURE__*/React.createElement(IconPaperclip, null),
143
148
  type: "tertiary"
144
- }, "\u70B9\u51FB\u4E0A\u4F20");
149
+ }, t('upload.clickToUpload'));
145
150
  var customRequest = /*#__PURE__*/function () {
146
151
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
147
152
  var file, onSuccess, onError, controller, formData, rawFile, _response$result2, response, responseObj;
@@ -217,7 +222,7 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
217
222
  _context.next = 29;
218
223
  break;
219
224
  }
220
- Toast.error('无法连接到网络');
225
+ Toast.error(t('common.networkUnavailable'));
221
226
  dispatch(setFileList({
222
227
  fileList: [{
223
228
  uid: file.uid,
@@ -228,7 +233,7 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
228
233
  }));
229
234
  return _context.abrupt("return");
230
235
  case 29:
231
- Toast.error('上传失败');
236
+ Toast.error(t('upload.failed'));
232
237
  onError === null || onError === void 0 || onError(_context.t0);
233
238
  case 31:
234
239
  case "end":
@@ -249,13 +254,15 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
249
254
  limit: limit || 1,
250
255
  multiple: (limit || 1) > 1,
251
256
  onExceed: function onExceed() {
252
- return Toast.warning("\u5355\u6B21\u4EC5\u652F\u6301\u4E0A\u4F20".concat(limit || 1, "\u4E2A\u6587\u4EF6"));
257
+ return Toast.warning(t('upload.batchLimit', {
258
+ limit: limit || 1
259
+ }));
253
260
  },
254
261
  onSizeError: function onSizeError() {
255
- return Toast.warning("\u6587\u4EF6\u5927\u5C0F\u8D85\u51FA\u9650\u5236");
262
+ return Toast.warning(t('upload.sizeExceeded'));
256
263
  },
257
264
  onAcceptInvalid: function onAcceptInvalid() {
258
- return Toast.warning("\u4E0D\u652F\u6301\u8BE5\u6587\u4EF6\u7C7B\u578B");
265
+ return Toast.warning(t('upload.typeUnsupported'));
259
266
  },
260
267
  accept: (accept === null || accept === void 0 ? void 0 : accept.join(',')) || defaultFileLimit,
261
268
  fileList: transformFileItem(fileList || []),
@@ -9,14 +9,17 @@ import { knowledgeConstants } from "../../constants";
9
9
  import { useAppDispatch, useAppSelector } from "../../store/hooks";
10
10
  import { openSidebar } from "../../store/slices/gimiMenuSlice";
11
11
  import React from 'react';
12
+ import { useTranslation } from 'react-i18next';
12
13
  var KnowledgeIcon = function KnowledgeIcon(_ref) {
13
14
  var url = _ref.url;
15
+ var _useTranslation = useTranslation(),
16
+ t = _useTranslation.t;
14
17
  return /*#__PURE__*/React.createElement("img", {
15
18
  style: {
16
19
  width: '12px',
17
20
  height: '12px'
18
21
  },
19
- alt: "\u77E5\u8BC6\u5E93\u6EAF\u6E90\u56FE\u6807",
22
+ alt: t('trace.iconAlt'),
20
23
  src: url
21
24
  });
22
25
  };
@@ -24,6 +27,8 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
24
27
  var type = _ref2.type,
25
28
  resources = _ref2.resources,
26
29
  messageId = _ref2.messageId;
30
+ var _useTranslation2 = useTranslation(),
31
+ t = _useTranslation2.t;
27
32
  var dispatch = useAppDispatch();
28
33
  var lastMessageId = useAppSelector(function (state) {
29
34
  var list = state.gimiMenu.messageList;
@@ -53,7 +58,10 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
53
58
  onClick: handleIconClick
54
59
  }, /*#__PURE__*/React.createElement(KnowledgeIcon, {
55
60
  url: iconUrl
56
- }), /*#__PURE__*/React.createElement("span", null, "".concat(resources === null || resources === void 0 ? void 0 : resources.length, "\u4E2A").concat(type === 'video' ? '视频' : type === 'product' ? '课程' : '文档')));
61
+ }), /*#__PURE__*/React.createElement("span", null, t('trace.countByType', {
62
+ count: resources === null || resources === void 0 ? void 0 : resources.length,
63
+ type: type === 'video' ? t('knowledgeTrace.type.video') : type === 'product' ? t('knowledgeTrace.type.course') : t('knowledgeTrace.type.document')
64
+ })));
57
65
  };
58
66
  var KnowledgeIconGroup = function KnowledgeIconGroup(_ref3) {
59
67
  var content = _ref3.content,
@@ -1,11 +1,14 @@
1
1
  import styles from "./index.module.css";
2
2
  import classNames from 'classnames';
3
3
  import React from 'react';
4
+ import { useTranslation } from 'react-i18next';
4
5
  import { Toast, Tooltip } from '@douyinfe/semi-ui';
5
6
  import { useAppSelector } from "../../store/hooks";
6
7
  var ClassItem = function ClassItem(_ref) {
7
8
  var _konwledgeTraceState$, _item$name;
8
9
  var item = _ref.item;
10
+ var _useTranslation = useTranslation(),
11
+ t = _useTranslation.t;
9
12
  var konwledgeTraceState = useAppSelector(function (state) {
10
13
  return state.gimiMenu.sidebar.knowledgeTrace;
11
14
  });
@@ -24,7 +27,7 @@ var ClassItem = function ClassItem(_ref) {
24
27
  }, [item.showStyle, item.equityLabel]);
25
28
  var handleClick = function handleClick() {
26
29
  if (item.isDelete === 1) return;
27
- if (platform !== 'myun') return Toast.warning('当前平台不支持溯源跳转');
30
+ if (platform !== 'myun') return Toast.warning(t('trace.jumpUnsupported'));
28
31
  if (item.isJoinClass) {
29
32
  if (item.productType === 'single') {
30
33
  window.open("/courseDetail/".concat(item.gradeId));
@@ -43,7 +46,7 @@ var ClassItem = function ClassItem(_ref) {
43
46
  className: classNames(styles.knowledge, item.isDelete === 1 ? styles.resource_deactive : isActive ? styles.active : ''),
44
47
  onClick: handleClick
45
48
  }, /*#__PURE__*/React.createElement("img", {
46
- alt: "\u8BFE\u7A0B\u5C01\u9762",
49
+ alt: t('trace.course.coverAlt'),
47
50
  className: styles.class_img,
48
51
  src: item.productUrl
49
52
  }), /*#__PURE__*/React.createElement("div", {
@@ -54,15 +57,19 @@ var ClassItem = function ClassItem(_ref) {
54
57
  content: item.name
55
58
  }, ((_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.length) > 33 ? "".concat(item.name.substring(0, 33), "...") : item.name || '')), item.isDelete === 1 && /*#__PURE__*/React.createElement("div", {
56
59
  className: styles.knowledge_trace_deactive
57
- }, "\u8BFE\u7A0B\u5931\u6548")));
60
+ }, t('trace.course.invalid'))));
58
61
  };
59
62
  var ClassList = function ClassList(_ref2) {
60
63
  var list = _ref2.list;
64
+ var _useTranslation2 = useTranslation(),
65
+ t = _useTranslation2.t;
61
66
  return /*#__PURE__*/React.createElement("div", {
62
67
  className: styles.knowledgeList
63
68
  }, /*#__PURE__*/React.createElement("span", {
64
69
  className: styles.total
65
- }, "\u672C\u5BF9\u8BDD\u5171".concat((list === null || list === void 0 ? void 0 : list.length) || 0, "\u4E2A\u8BFE\u7A0B")), list.map(function (item) {
70
+ }, t('trace.course.total', {
71
+ count: (list === null || list === void 0 ? void 0 : list.length) || 0
72
+ })), list.map(function (item) {
66
73
  return /*#__PURE__*/React.createElement(ClassItem, {
67
74
  item: item,
68
75
  key: item.id