@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.
- package/dist/client/components/history-list/index.js +14 -11
- package/dist/client/components/slider/index.js +5 -2
- package/dist/client/core/index.js +6 -2
- package/dist/components/ai-chat-dialogue/index.js +26 -23
- package/dist/components/ai-loading/index.js +4 -1
- package/dist/components/answer-item/index.js +7 -4
- package/dist/components/ask-card/index.js +5 -2
- package/dist/components/ask-card/index.module.css +8 -1
- package/dist/components/chat-input/index.js +29 -25
- package/dist/components/chat-voice/VoiceCommunication.js +6 -4
- package/dist/components/chat-voice/VoiceRecord.js +6 -3
- package/dist/components/conversation-delete/index.js +5 -2
- package/dist/components/excel-components/ExcelExcuting.js +28 -23
- package/dist/components/excel-components/ExcelFailCard.js +4 -1
- package/dist/components/excel-components/ExcelSuccessCard.js +8 -5
- package/dist/components/excel-components/index.module.css +1 -1
- package/dist/components/file-card/fileCardSidebar.js +7 -2
- package/dist/components/file-card/index.js +10 -5
- package/dist/components/file-card/index.module.css +3 -1
- package/dist/components/file-upload/index.js +15 -7
- package/dist/components/file-upload/uploadV1.js +15 -8
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +10 -2
- package/dist/components/knowledge-trace/classList.js +11 -4
- package/dist/components/knowledge-trace/documentList.js +11 -4
- package/dist/components/knowledge-trace/index.js +6 -3
- package/dist/components/knowledge-trace/index.module.css +6 -3
- package/dist/components/knowledge-trace/videoList.js +16 -6
- package/dist/components/message-actions/CopyButton.js +4 -1
- package/dist/components/message-actions/LikeButton.js +4 -1
- package/dist/components/message-actions/RegenerateButton.js +5 -2
- package/dist/components/message-actions/UnLikeButton.js +4 -1
- package/dist/components/message-actions/VoicePlay.js +6 -2
- package/dist/components/no-microphone-root/index.js +9 -7
- package/dist/components/no-microphone-root/index.module.css +10 -1
- package/dist/components/product-tag/index.js +10 -7
- package/dist/components/quoted-content/index.js +17 -12
- package/dist/components/reasoning-content/index.js +8 -5
- package/dist/components/reasoning-search/index.d.ts +1 -1
- package/dist/components/reasoning-search/index.js +15 -6
- package/dist/components/reference-content/index.js +10 -3
- package/dist/components/search-course-list/index.js +13 -6
- package/dist/components/search-course-list/index.module.css +6 -3
- package/dist/components/search-course-list/sidebar.js +7 -2
- package/dist/components/templates/GimiChatComponent.js +5 -1
- package/dist/components/unified-sidebar/FileListContent.js +8 -2
- package/dist/components/unified-sidebar/KnowledgeTraceContent.d.ts +1 -0
- package/dist/components/unified-sidebar/KnowledgeTraceContent.js +33 -3
- package/dist/components/unified-sidebar/SearchCourseListContent.js +8 -4
- package/dist/components/unified-sidebar/index.js +14 -8
- package/dist/components/upload-list/index.js +6 -3
- package/dist/components/voice-recording/index.js +10 -7
- package/dist/components/work-flow-content/index.js +7 -1
- package/dist/hooks/useChatActions.js +9 -6
- package/dist/hooks/useChatHistory.js +4 -1
- package/dist/hooks/useChatRecommend.js +7 -4
- package/dist/hooks/useChatStream.js +12 -2
- package/dist/hooks/useChatVoice.js +12 -6
- package/dist/hooks/useCommonChatAPI.js +25 -21
- package/dist/hooks/useFile.js +14 -9
- package/dist/hooks/useLongPoll.js +5 -2
- package/dist/hooks/useSearchCase.js +5 -2
- package/dist/i18n/GimiChatI18nProvider.d.ts +9 -0
- package/dist/i18n/GimiChatI18nProvider.js +25 -0
- package/dist/i18n/core.d.ts +12 -0
- package/dist/i18n/core.js +71 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/locales/en-US.d.ts +216 -0
- package/dist/i18n/locales/en-US.js +242 -0
- package/dist/i18n/locales/zh-CN.d.ts +216 -0
- package/dist/i18n/locales/zh-CN.js +242 -0
- package/dist/i18n/useGimiChatTranslation.d.ts +2 -0
- package/dist/i18n/useGimiChatTranslation.js +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/chat.d.ts +4 -1
- package/dist/types/modules.d.ts +1 -0
- package/dist/umd/index.min.js +1 -1
- package/dist/utils/tools.d.ts +1 -1
- package/dist/utils/tools.js +5 -5
- package/dist/utils/voice-stream.d.ts +2 -0
- package/dist/utils/voice-stream.js +43 -20
- package/package.json +6 -4
|
@@ -13,9 +13,12 @@ import { useAppSelector, useAppDispatch } from "../../store/hooks";
|
|
|
13
13
|
import { setQuoteTeachModelList, setQuoteProductList } from "../../store/slices/gimiMenuSlice";
|
|
14
14
|
import { formatSecondsToChinese } from "../../utils/tools";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
16
17
|
export var TeachModelReferenceContent = function TeachModelReferenceContent(_ref) {
|
|
17
18
|
var item = _ref.item,
|
|
18
19
|
showDuration = _ref.showDuration;
|
|
20
|
+
var _useTranslation = useTranslation(),
|
|
21
|
+
t = _useTranslation.t;
|
|
19
22
|
var quoteTeachModelList = useAppSelector(function (state) {
|
|
20
23
|
return state.gimiMenu.quoteTeachModelList;
|
|
21
24
|
});
|
|
@@ -33,7 +36,7 @@ export var TeachModelReferenceContent = function TeachModelReferenceContent(_ref
|
|
|
33
36
|
className: styles.closeIcon,
|
|
34
37
|
onClick: onCancel
|
|
35
38
|
}), /*#__PURE__*/React.createElement("img", {
|
|
36
|
-
alt:
|
|
39
|
+
alt: t('quote.imageAlt'),
|
|
37
40
|
className: styles.img,
|
|
38
41
|
src: knowledgeConstants.VIDEO_ICON_ADDRESS
|
|
39
42
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -44,10 +47,14 @@ export var TeachModelReferenceContent = function TeachModelReferenceContent(_ref
|
|
|
44
47
|
className: classNames(item.canCancel ? styles.text_oneline : styles.text_twoline)
|
|
45
48
|
}, item.teachModelName)), item.duration > 0 && showDuration && /*#__PURE__*/React.createElement("div", {
|
|
46
49
|
className: styles.duration
|
|
47
|
-
},
|
|
50
|
+
}, t('quote.durationMinutes', {
|
|
51
|
+
minutes: formatSecondsToChinese(item.duration)
|
|
52
|
+
}))));
|
|
48
53
|
};
|
|
49
54
|
export var ProductReferenceContent = function ProductReferenceContent(_ref2) {
|
|
50
55
|
var item = _ref2.item;
|
|
56
|
+
var _useTranslation2 = useTranslation(),
|
|
57
|
+
t = _useTranslation2.t;
|
|
51
58
|
var quoteProductList = useAppSelector(function (state) {
|
|
52
59
|
return state.gimiMenu.quoteProductList;
|
|
53
60
|
});
|
|
@@ -65,7 +72,7 @@ export var ProductReferenceContent = function ProductReferenceContent(_ref2) {
|
|
|
65
72
|
className: styles.closeIcon,
|
|
66
73
|
onClick: onCancel
|
|
67
74
|
}), /*#__PURE__*/React.createElement("img", {
|
|
68
|
-
alt:
|
|
75
|
+
alt: t('quote.imageAlt'),
|
|
69
76
|
className: styles.img,
|
|
70
77
|
src: knowledgeConstants.CLASS_ICON_BIG_ADDRESS
|
|
71
78
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconChevronRightStroked } from '@douyinfe/semi-icons';
|
|
2
2
|
import styles from "./index.module.css";
|
|
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
|
|
|
@@ -11,17 +12,19 @@ export var CourseCard = function CourseCard(_ref) {
|
|
|
11
12
|
var item = _ref.item,
|
|
12
13
|
_ref$width = _ref.width,
|
|
13
14
|
width = _ref$width === void 0 ? 296 : _ref$width;
|
|
15
|
+
var _useTranslation = useTranslation(),
|
|
16
|
+
t = _useTranslation.t;
|
|
14
17
|
var platform = useAppSelector(function (state) {
|
|
15
18
|
return state.gimiMenu.platform;
|
|
16
19
|
});
|
|
17
20
|
var handleClick = function handleClick() {
|
|
18
21
|
if (platform !== 'myun') {
|
|
19
|
-
Toast.error('
|
|
22
|
+
Toast.error(t('course.jumpUnsupported'));
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
25
|
var courseId = Number(item.productId);
|
|
23
26
|
if (isNaN(courseId)) {
|
|
24
|
-
return Toast.error('
|
|
27
|
+
return Toast.error(t('course.noValidCourse'));
|
|
25
28
|
}
|
|
26
29
|
if (item.productType === 'single') {
|
|
27
30
|
window.open("/new-product/".concat(courseId));
|
|
@@ -37,7 +40,7 @@ export var CourseCard = function CourseCard(_ref) {
|
|
|
37
40
|
},
|
|
38
41
|
onClick: handleClick
|
|
39
42
|
}, /*#__PURE__*/React.createElement("img", {
|
|
40
|
-
alt:
|
|
43
|
+
alt: t('course.coverAlt'),
|
|
41
44
|
className: styles.class_img,
|
|
42
45
|
src: item.cover
|
|
43
46
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -46,7 +49,7 @@ export var CourseCard = function CourseCard(_ref) {
|
|
|
46
49
|
className: styles.text
|
|
47
50
|
}, !item.learnable && /*#__PURE__*/React.createElement("div", {
|
|
48
51
|
className: styles.tag_badge_default
|
|
49
|
-
}, '
|
|
52
|
+
}, t('course.noRights')), /*#__PURE__*/React.createElement(Tooltip, {
|
|
50
53
|
content: item.productName
|
|
51
54
|
}, ((_item$productName = item.productName) === null || _item$productName === void 0 ? void 0 : _item$productName.length) > cutNumber ? "".concat(item.productName.substring(0, cutNumber), "...") : item.productName || ''))));
|
|
52
55
|
};
|
|
@@ -54,6 +57,8 @@ var SearchCourseList = function SearchCourseList(_ref2) {
|
|
|
54
57
|
var _ref2$courseList = _ref2.courseList,
|
|
55
58
|
courseList = _ref2$courseList === void 0 ? [] : _ref2$courseList,
|
|
56
59
|
onMoreClick = _ref2.onMoreClick;
|
|
60
|
+
var _useTranslation2 = useTranslation(),
|
|
61
|
+
t = _useTranslation2.t;
|
|
57
62
|
var hasMore = courseList.length > 4;
|
|
58
63
|
var displayList = hasMore ? courseList.slice(0, 4) : courseList;
|
|
59
64
|
if (!(courseList !== null && courseList !== void 0 && courseList.length)) {
|
|
@@ -65,10 +70,12 @@ var SearchCourseList = function SearchCourseList(_ref2) {
|
|
|
65
70
|
className: styles.search_header
|
|
66
71
|
}, /*#__PURE__*/React.createElement("span", {
|
|
67
72
|
className: styles.search_header_summary
|
|
68
|
-
},
|
|
73
|
+
}, t('course.searchSummary', {
|
|
74
|
+
count: courseList.length
|
|
75
|
+
})), hasMore && /*#__PURE__*/React.createElement("span", {
|
|
69
76
|
className: styles.search_header_more,
|
|
70
77
|
onClick: onMoreClick
|
|
71
|
-
},
|
|
78
|
+
}, t('course.viewMore'), /*#__PURE__*/React.createElement(IconChevronRightStroked, {
|
|
72
79
|
style: {
|
|
73
80
|
fontSize: '14px'
|
|
74
81
|
}
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
line-height: 18px;
|
|
76
76
|
letter-spacing: 0px;
|
|
77
77
|
text-align: center;
|
|
78
|
-
width:
|
|
78
|
+
width: fit-content;
|
|
79
|
+
padding: 0 5px;
|
|
79
80
|
height: 18px;
|
|
80
81
|
border-radius: 4px;
|
|
81
82
|
float: left;
|
|
@@ -90,7 +91,8 @@
|
|
|
90
91
|
line-height: 18px;
|
|
91
92
|
letter-spacing: 0px;
|
|
92
93
|
text-align: center;
|
|
93
|
-
width:
|
|
94
|
+
width: fit-content;
|
|
95
|
+
padding: 0 5px;
|
|
94
96
|
height: 18px;
|
|
95
97
|
border-radius: 4px;
|
|
96
98
|
float: left;
|
|
@@ -105,7 +107,8 @@
|
|
|
105
107
|
line-height: 18px;
|
|
106
108
|
letter-spacing: 0px;
|
|
107
109
|
text-align: center;
|
|
108
|
-
width:
|
|
110
|
+
width: fit-content;
|
|
111
|
+
padding: 0 5px;
|
|
109
112
|
height: 18px;
|
|
110
113
|
border-radius: 4px;
|
|
111
114
|
float: left;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { CourseCard } from "./index";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import styles from "./index.module.css";
|
|
4
5
|
import GimiSideBar from "../gimi-sidebar";
|
|
5
6
|
var SearchCourseListSidebar = function SearchCourseListSidebar(props) {
|
|
7
|
+
var _useTranslation = useTranslation(),
|
|
8
|
+
t = _useTranslation.t;
|
|
6
9
|
var sidebarTargetElm = props.sidebarTargetElm,
|
|
7
10
|
isOverFlow = props.isOverFlow,
|
|
8
11
|
className = props.className,
|
|
@@ -17,7 +20,7 @@ var SearchCourseListSidebar = function SearchCourseListSidebar(props) {
|
|
|
17
20
|
return /*#__PURE__*/React.createElement(GimiSideBar, {
|
|
18
21
|
show: show,
|
|
19
22
|
isOverFlow: isOverFlow,
|
|
20
|
-
title: '
|
|
23
|
+
title: t('sidebar.searchCourseList'),
|
|
21
24
|
handleClose: onClose,
|
|
22
25
|
className: className,
|
|
23
26
|
style: style,
|
|
@@ -26,7 +29,9 @@ var SearchCourseListSidebar = function SearchCourseListSidebar(props) {
|
|
|
26
29
|
className: styles.list
|
|
27
30
|
}, /*#__PURE__*/React.createElement("span", {
|
|
28
31
|
className: styles.total
|
|
29
|
-
},
|
|
32
|
+
}, t('course.totalInConversation', {
|
|
33
|
+
count: (courseList === null || courseList === void 0 ? void 0 : courseList.length) || 0
|
|
34
|
+
})), courseList.map(function (item, index) {
|
|
30
35
|
return /*#__PURE__*/React.createElement(CourseCard, {
|
|
31
36
|
key: item.productId,
|
|
32
37
|
item: item
|
|
@@ -5,6 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import { Provider } from 'react-redux';
|
|
6
6
|
import ChatContext from "./chatContext";
|
|
7
7
|
import useApi from "../../apis/useApi";
|
|
8
|
+
import { GimiChatI18nProvider } from "../../i18n";
|
|
8
9
|
var GimiChatComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
9
10
|
var store = React.useMemo(function () {
|
|
10
11
|
return createStore();
|
|
@@ -37,12 +38,15 @@ var GimiChatComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
37
38
|
var apiService = useApi(props.baseUrl, props.token);
|
|
38
39
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
39
40
|
store: store
|
|
41
|
+
}, /*#__PURE__*/React.createElement(GimiChatI18nProvider, {
|
|
42
|
+
locale: props.locale,
|
|
43
|
+
messages: props.localeMessages
|
|
40
44
|
}, /*#__PURE__*/React.createElement(ChatContext.Provider, {
|
|
41
45
|
value: {
|
|
42
46
|
apiService: apiService
|
|
43
47
|
}
|
|
44
48
|
}, /*#__PURE__*/React.createElement(CommonChat, _extends({}, props, {
|
|
45
49
|
ref: commonChatRef
|
|
46
|
-
}))));
|
|
50
|
+
})))));
|
|
47
51
|
});
|
|
48
52
|
export default GimiChatComponent;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import styles from "../file-card/index.module.css";
|
|
3
4
|
import { useAppSelector } from "../../store/hooks";
|
|
4
5
|
import { FileCard } from "../file-card";
|
|
5
6
|
var FileListContent = function FileListContent(_ref) {
|
|
6
7
|
var isOverFlow = _ref.isOverFlow;
|
|
8
|
+
var _useTranslation = useTranslation(),
|
|
9
|
+
t = _useTranslation.t;
|
|
7
10
|
var sidebar = useAppSelector(function (state) {
|
|
8
11
|
return state.gimiMenu.sidebar;
|
|
9
12
|
});
|
|
@@ -12,14 +15,17 @@ var FileListContent = function FileListContent(_ref) {
|
|
|
12
15
|
className: styles.list
|
|
13
16
|
}, /*#__PURE__*/React.createElement("span", {
|
|
14
17
|
className: styles.total
|
|
15
|
-
},
|
|
18
|
+
}, t('file.totalInConversation', {
|
|
19
|
+
count: (fileList === null || fileList === void 0 ? void 0 : fileList.length) || 0
|
|
20
|
+
})), fileList.map(function (file, index) {
|
|
16
21
|
return /*#__PURE__*/React.createElement(FileCard, {
|
|
17
22
|
fileName: file.fileName,
|
|
18
23
|
fileType: file.fileType,
|
|
19
24
|
size: file.size,
|
|
20
25
|
downloadUrl: file.downloadUrl,
|
|
21
26
|
key: index,
|
|
22
|
-
model: isOverFlow ? 'sidebar' : 'fullscreen'
|
|
27
|
+
model: isOverFlow ? 'sidebar' : 'fullscreen',
|
|
28
|
+
downloadText: t('file.download')
|
|
23
29
|
});
|
|
24
30
|
}));
|
|
25
31
|
};
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
export declare type KonwledgeType = 'video' | 'document' | 'product';
|
|
3
3
|
interface KnowledgeTraceContentProps {
|
|
4
4
|
onCurrentTraceVideoClick?: (time?: string) => void;
|
|
5
|
+
parentRef: React.RefObject<HTMLDivElement>;
|
|
5
6
|
}
|
|
6
7
|
declare const KnowledgeTraceContent: React.FC<KnowledgeTraceContentProps>;
|
|
7
8
|
export default KnowledgeTraceContent;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
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
7
|
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); }
|
|
@@ -5,6 +9,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
9
|
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
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
11
|
import React from 'react';
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
8
13
|
import styles from "../knowledge-trace/index.module.css";
|
|
9
14
|
import { useAppSelector } from "../../store/hooks";
|
|
10
15
|
import { Tabs, TabPane } from '@douyinfe/semi-ui';
|
|
@@ -15,7 +20,10 @@ import { getKnowledgeTraceListFromConent } from "../../utils/tools";
|
|
|
15
20
|
import useKnowledgeService from "../../hooks/useKnowledgeService";
|
|
16
21
|
import AiLoading from "../ai-loading";
|
|
17
22
|
var KnowledgeTraceContent = function KnowledgeTraceContent(_ref) {
|
|
18
|
-
var onCurrentTraceVideoClick = _ref.onCurrentTraceVideoClick
|
|
23
|
+
var onCurrentTraceVideoClick = _ref.onCurrentTraceVideoClick,
|
|
24
|
+
parentRef = _ref.parentRef;
|
|
25
|
+
var _useTranslation = useTranslation(),
|
|
26
|
+
t = _useTranslation.t;
|
|
19
27
|
var sidebar = useAppSelector(function (state) {
|
|
20
28
|
return state.gimiMenu.sidebar;
|
|
21
29
|
});
|
|
@@ -48,13 +56,13 @@ var KnowledgeTraceContent = function KnowledgeTraceContent(_ref) {
|
|
|
48
56
|
setTabList(function () {
|
|
49
57
|
return kowledgeTraceList.map(function (item) {
|
|
50
58
|
return {
|
|
51
|
-
name: item.type === 'document' ? '
|
|
59
|
+
name: item.type === 'document' ? t('knowledgeTrace.type.document') : item.type === 'video' ? t('knowledgeTrace.type.video') : t('knowledgeTrace.type.course'),
|
|
52
60
|
type: item.type
|
|
53
61
|
};
|
|
54
62
|
});
|
|
55
63
|
});
|
|
56
64
|
}
|
|
57
|
-
}, [kowledgeTraceList]);
|
|
65
|
+
}, [kowledgeTraceList, t]);
|
|
58
66
|
var _useKnowledgeService = useKnowledgeService(kowledgeTraceList),
|
|
59
67
|
videoSliceList = _useKnowledgeService.videoSliceList,
|
|
60
68
|
documentList = _useKnowledgeService.documentList,
|
|
@@ -63,6 +71,28 @@ var KnowledgeTraceContent = function KnowledgeTraceContent(_ref) {
|
|
|
63
71
|
React.useEffect(function () {
|
|
64
72
|
setActiveKey(konwledgeTraceState.type);
|
|
65
73
|
}, [konwledgeTraceState.type]);
|
|
74
|
+
React.useEffect(function () {
|
|
75
|
+
if ([].concat(_toConsumableArray(videoSliceList), _toConsumableArray(documentList), _toConsumableArray(productList)).length === 0 || !parentRef.current) return;
|
|
76
|
+
var timer = setTimeout(function () {
|
|
77
|
+
var _parentRef$current;
|
|
78
|
+
var tabPane = (_parentRef$current = parentRef.current) === null || _parentRef$current === void 0 ? void 0 : _parentRef$current.contentRef.current;
|
|
79
|
+
if (!tabPane) return;
|
|
80
|
+
// 滚动到第一个匹配的溯源项
|
|
81
|
+
var activeElement = tabPane.querySelector(".".concat(styles.active));
|
|
82
|
+
if (activeElement) {
|
|
83
|
+
// 检查是否有滚动条
|
|
84
|
+
if (tabPane.scrollHeight > tabPane.clientHeight) {
|
|
85
|
+
activeElement.scrollIntoView({
|
|
86
|
+
behavior: 'smooth',
|
|
87
|
+
block: 'start'
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, 100);
|
|
92
|
+
return function () {
|
|
93
|
+
return clearTimeout(timer);
|
|
94
|
+
};
|
|
95
|
+
}, [konwledgeTraceState, videoSliceList, documentList, productList, parentRef]);
|
|
66
96
|
var handleTabChange = function handleTabChange(activeKey) {
|
|
67
97
|
setActiveKey(activeKey);
|
|
68
98
|
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import styles from "../search-course-list/index.module.css";
|
|
3
4
|
import { useAppSelector } from "../../store/hooks";
|
|
4
5
|
import { CourseCard } from "../search-course-list";
|
|
5
6
|
var SearchCourseListContent = function SearchCourseListContent() {
|
|
6
|
-
var
|
|
7
|
-
|
|
7
|
+
var _useTranslation = useTranslation(),
|
|
8
|
+
t = _useTranslation.t;
|
|
9
|
+
var courseList = useAppSelector(function (state) {
|
|
10
|
+
return state.gimiMenu.sidebar.searchCourseList;
|
|
8
11
|
});
|
|
9
|
-
var courseList = sidebar.searchCourseList;
|
|
10
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
11
13
|
className: styles.list
|
|
12
14
|
}, /*#__PURE__*/React.createElement("span", {
|
|
13
15
|
className: styles.total
|
|
14
|
-
},
|
|
16
|
+
}, t('course.totalInConversation', {
|
|
17
|
+
count: (courseList === null || courseList === void 0 ? void 0 : courseList.length) || 0
|
|
18
|
+
})), courseList.map(function (item) {
|
|
15
19
|
return /*#__PURE__*/React.createElement(CourseCard, {
|
|
16
20
|
key: item.productId,
|
|
17
21
|
item: item
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import { useAppSelector, useAppDispatch } from "../../store/hooks";
|
|
3
4
|
import { closeSidebar } from "../../store/slices/gimiMenuSlice";
|
|
4
5
|
import GimiSideBar from "../gimi-sidebar";
|
|
@@ -6,37 +7,41 @@ import KnowledgeTraceContent from "./KnowledgeTraceContent";
|
|
|
6
7
|
import FileListContent from "./FileListContent";
|
|
7
8
|
import ReasoningSearchContent from "./ReasoningSearchContent";
|
|
8
9
|
import SearchCourseListContent from "./SearchCourseListContent";
|
|
9
|
-
var sidebarTitleMap = {
|
|
10
|
-
knowledgeTrace: '引用来源',
|
|
11
|
-
fileList: '全部',
|
|
12
|
-
reasoningSearch: '搜索来源',
|
|
13
|
-
searchCourseList: '搜索结果'
|
|
14
|
-
};
|
|
15
10
|
var UnifiedSidebar = function UnifiedSidebar(_ref) {
|
|
16
11
|
var sidebarTargetElm = _ref.sidebarTargetElm,
|
|
17
12
|
isOverFlow = _ref.isOverFlow,
|
|
18
13
|
className = _ref.className,
|
|
19
14
|
style = _ref.style,
|
|
20
15
|
onCurrentTraceVideoClick = _ref.onCurrentTraceVideoClick;
|
|
16
|
+
var _useTranslation = useTranslation(),
|
|
17
|
+
t = _useTranslation.t;
|
|
21
18
|
var dispatch = useAppDispatch();
|
|
22
19
|
var sidebar = useAppSelector(function (state) {
|
|
23
20
|
return state.gimiMenu.sidebar;
|
|
24
21
|
});
|
|
22
|
+
var tabPaneRef = React.useRef(null);
|
|
25
23
|
var handleClose = useCallback(function () {
|
|
26
24
|
dispatch(closeSidebar());
|
|
27
25
|
}, [dispatch]);
|
|
28
26
|
var title = useMemo(function () {
|
|
29
27
|
if (!sidebar.type) return '';
|
|
28
|
+
var sidebarTitleMap = {
|
|
29
|
+
knowledgeTrace: t('sidebar.knowledgeTrace'),
|
|
30
|
+
fileList: t('sidebar.fileList'),
|
|
31
|
+
reasoningSearch: t('sidebar.reasoningSearch'),
|
|
32
|
+
searchCourseList: t('sidebar.searchCourseList')
|
|
33
|
+
};
|
|
30
34
|
if (sidebar.type === 'reasoningSearch') {
|
|
31
35
|
return "".concat(sidebarTitleMap.reasoningSearch, " ").concat(sidebar.reasoningSearchList.length);
|
|
32
36
|
}
|
|
33
37
|
return sidebarTitleMap[sidebar.type];
|
|
34
|
-
}, [sidebar.type, sidebar.reasoningSearchList.length]);
|
|
38
|
+
}, [sidebar.type, sidebar.reasoningSearchList.length, t]);
|
|
35
39
|
var renderContent = useCallback(function () {
|
|
36
40
|
switch (sidebar.type) {
|
|
37
41
|
case 'knowledgeTrace':
|
|
38
42
|
return /*#__PURE__*/React.createElement(KnowledgeTraceContent, {
|
|
39
|
-
onCurrentTraceVideoClick: onCurrentTraceVideoClick
|
|
43
|
+
onCurrentTraceVideoClick: onCurrentTraceVideoClick,
|
|
44
|
+
parentRef: tabPaneRef
|
|
40
45
|
});
|
|
41
46
|
case 'fileList':
|
|
42
47
|
return /*#__PURE__*/React.createElement(FileListContent, {
|
|
@@ -52,6 +57,7 @@ var UnifiedSidebar = function UnifiedSidebar(_ref) {
|
|
|
52
57
|
}, [sidebar.type, isOverFlow, onCurrentTraceVideoClick]);
|
|
53
58
|
if (!sidebar.type) return null;
|
|
54
59
|
return /*#__PURE__*/React.createElement(GimiSideBar, {
|
|
60
|
+
ref: tabPaneRef,
|
|
55
61
|
show: !!sidebar.type,
|
|
56
62
|
isOverFlow: isOverFlow,
|
|
57
63
|
title: title,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import styles from "./index.module.css";
|
|
3
4
|
import reTry from "../../assets/image/retry.png";
|
|
4
5
|
import { FileStatus } from "../../interfaces/fileInterface";
|
|
@@ -9,6 +10,8 @@ var UploadFile = function UploadFile(_ref) {
|
|
|
9
10
|
handleReTry = _ref.handleReTry,
|
|
10
11
|
_ref$showDel = _ref.showDel,
|
|
11
12
|
showDel = _ref$showDel === void 0 ? true : _ref$showDel;
|
|
13
|
+
var _useTranslation = useTranslation(),
|
|
14
|
+
t = _useTranslation.t;
|
|
12
15
|
// 使用useMemo缓存icon,避免每次渲染重新计算
|
|
13
16
|
var _React$useMemo = React.useMemo(function () {
|
|
14
17
|
var _file$fileName, _file$name;
|
|
@@ -64,15 +67,15 @@ var UploadFile = function UploadFile(_ref) {
|
|
|
64
67
|
className: styles.size
|
|
65
68
|
}, fileSize), isError && /*#__PURE__*/React.createElement("span", {
|
|
66
69
|
className: styles.errorText
|
|
67
|
-
}, file.status === FileStatus.UPLOAD_FAILED ? '
|
|
70
|
+
}, file.status === FileStatus.UPLOAD_FAILED ? t('upload.status.uploadFailed') : file.status === FileStatus.NETWORK_ERROR ? t('upload.status.networkError') : t('upload.status.parseFailed')))), isLoading && /*#__PURE__*/React.createElement("div", {
|
|
68
71
|
className: styles.uploadLoading
|
|
69
|
-
}, /*#__PURE__*/React.createElement("span", null, file.status === FileStatus.PADDING ? '
|
|
72
|
+
}, /*#__PURE__*/React.createElement("span", null, file.status === FileStatus.PADDING ? t('upload.status.parsing') : file.status === FileStatus.UPLOADING ? t('upload.status.uploading') : t('upload.status.retrying')), /*#__PURE__*/React.createElement("img", {
|
|
70
73
|
src: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202509/07/0a0fa_20250907093927.gif",
|
|
71
74
|
alt: "loading"
|
|
72
75
|
})), isError && /*#__PURE__*/React.createElement("div", {
|
|
73
76
|
className: styles.uploadError,
|
|
74
77
|
onClick: handleRetryClick
|
|
75
|
-
},
|
|
78
|
+
}, t('common.retry'), /*#__PURE__*/React.createElement("img", {
|
|
76
79
|
src: reTry,
|
|
77
80
|
alt: "",
|
|
78
81
|
style: {
|
|
@@ -2,25 +2,28 @@ import { Tooltip } from '@douyinfe/semi-ui';
|
|
|
2
2
|
import VoiceBars from "../voice-bars";
|
|
3
3
|
import styles from "./index.module.css";
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
5
6
|
var CHECK_ICON_ADDRESS = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/04/8b0e2_20260104154821.png';
|
|
6
7
|
var CANCEL_ICON_ADDRESS = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/04/94bfe_20260104154857.png';
|
|
7
8
|
var VoiceRecording = function VoiceRecording(_ref) {
|
|
8
9
|
var recordingCount = _ref.recordingCount,
|
|
9
10
|
stopRecording = _ref.stopRecording,
|
|
10
11
|
containerWidth = _ref.containerWidth;
|
|
12
|
+
var _useTranslation = useTranslation(),
|
|
13
|
+
t = _useTranslation.t;
|
|
11
14
|
return /*#__PURE__*/React.createElement("div", {
|
|
12
15
|
className: styles.main
|
|
13
16
|
}, /*#__PURE__*/React.createElement("div", {
|
|
14
17
|
className: styles.text
|
|
15
18
|
}, /*#__PURE__*/React.createElement("span", {
|
|
16
19
|
className: styles.font_weight_600
|
|
17
|
-
},
|
|
20
|
+
}, t('voice.recording')), recordingCount > 0 && recordingCount <= 10 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
18
21
|
className: styles.font_weight_400
|
|
19
|
-
},
|
|
22
|
+
}, t('voice.countdownPrefix')), /*#__PURE__*/React.createElement("span", {
|
|
20
23
|
className: styles.count
|
|
21
24
|
}, recordingCount), /*#__PURE__*/React.createElement("span", {
|
|
22
25
|
className: styles.font_weight_400
|
|
23
|
-
},
|
|
26
|
+
}, t('voice.countdownSuffix')))), /*#__PURE__*/React.createElement("div", {
|
|
24
27
|
className: styles.voice_bar
|
|
25
28
|
}, /*#__PURE__*/React.createElement(VoiceBars, {
|
|
26
29
|
parentWidth: containerWidth - 48 * 2 - 20 * 2 - 10
|
|
@@ -30,22 +33,22 @@ var VoiceRecording = function VoiceRecording(_ref) {
|
|
|
30
33
|
gap: '10px'
|
|
31
34
|
}
|
|
32
35
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
33
|
-
content:
|
|
36
|
+
content: t('voice.abandon'),
|
|
34
37
|
arrowPointAtCenter: true
|
|
35
38
|
}, /*#__PURE__*/React.createElement("img", {
|
|
36
39
|
className: styles.icon,
|
|
37
40
|
src: CANCEL_ICON_ADDRESS,
|
|
38
|
-
alt:
|
|
41
|
+
alt: t('voice.abandon'),
|
|
39
42
|
onClick: function onClick() {
|
|
40
43
|
stopRecording(false);
|
|
41
44
|
}
|
|
42
45
|
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
43
|
-
content:
|
|
46
|
+
content: t('voice.startTranscribe'),
|
|
44
47
|
arrowPointAtCenter: true
|
|
45
48
|
}, /*#__PURE__*/React.createElement("img", {
|
|
46
49
|
className: styles.icon,
|
|
47
50
|
src: CHECK_ICON_ADDRESS,
|
|
48
|
-
alt:
|
|
51
|
+
alt: t('voice.startTranscribe'),
|
|
49
52
|
onClick: function onClick() {
|
|
50
53
|
stopRecording(true);
|
|
51
54
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import styles from "./index.module.css";
|
|
3
4
|
import { Spin } from '@douyinfe/semi-ui';
|
|
4
5
|
import { IconSpin, IconInfoCircle } from '@douyinfe/semi-icons';
|
|
@@ -15,11 +16,16 @@ var warnIcon = /*#__PURE__*/React.createElement(IconInfoCircle, {
|
|
|
15
16
|
});
|
|
16
17
|
var WorkFlowContent = function WorkFlowContent(_ref) {
|
|
17
18
|
var chatItem = _ref.chatItem;
|
|
19
|
+
var _useTranslation = useTranslation(),
|
|
20
|
+
t = _useTranslation.t;
|
|
21
|
+
|
|
18
22
|
// const isExecuting = chatItem.mcps.some((item: MCPItem) => !item.isFinished);
|
|
19
23
|
var mcp = chatItem.mcp;
|
|
20
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
21
25
|
className: styles.layout
|
|
22
|
-
}, mcp.status === 'executeWorkflowByDescription' ? '
|
|
26
|
+
}, mcp.status === 'executeWorkflowByDescription' ? t('workflow.querying') : mcp.status === 'interrupt' ? t('workflow.terminated') : t('workflow.calling', {
|
|
27
|
+
name: mcp.name || t('workflow.defaultName')
|
|
28
|
+
}), mcp.status === 'interrupt' ? warnIcon : /*#__PURE__*/React.createElement(Spin, {
|
|
23
29
|
className: styles.spin,
|
|
24
30
|
indicator: antIcon
|
|
25
31
|
}));
|
|
@@ -14,6 +14,7 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
14
14
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
15
15
|
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; }
|
|
16
16
|
import React from 'react';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
17
18
|
import { Toast } from "@douyinfe/semi-ui";
|
|
18
19
|
import { createFetch } from "../apis/fetch";
|
|
19
20
|
import { useAppSelector, useAppDispatch } from "../store/hooks";
|
|
@@ -27,6 +28,8 @@ var updateLastMessage = function updateLastMessage(chatList, updater) {
|
|
|
27
28
|
return [].concat(_toConsumableArray(chatList.slice(0, -1)), [updater(chatList[chatList.length - 1])]);
|
|
28
29
|
};
|
|
29
30
|
export var usePureChatActions = function usePureChatActions() {
|
|
31
|
+
var _useTranslation = useTranslation(),
|
|
32
|
+
t = _useTranslation.t;
|
|
30
33
|
var _useContext = useContext(ChatContext),
|
|
31
34
|
apiService = _useContext.apiService;
|
|
32
35
|
var _ref = apiService,
|
|
@@ -80,13 +83,13 @@ export var usePureChatActions = function usePureChatActions() {
|
|
|
80
83
|
_context.next = 7;
|
|
81
84
|
return navigator.clipboard.writeText(text);
|
|
82
85
|
case 7:
|
|
83
|
-
Toast.success('
|
|
86
|
+
Toast.success(t('action.copySuccess'));
|
|
84
87
|
_context.next = 13;
|
|
85
88
|
break;
|
|
86
89
|
case 10:
|
|
87
90
|
_context.prev = 10;
|
|
88
91
|
_context.t0 = _context["catch"](4);
|
|
89
|
-
Toast.error('
|
|
92
|
+
Toast.error(t('action.copyFailed'));
|
|
90
93
|
case 13:
|
|
91
94
|
case "end":
|
|
92
95
|
return _context.stop();
|
|
@@ -96,7 +99,7 @@ export var usePureChatActions = function usePureChatActions() {
|
|
|
96
99
|
return function (_x) {
|
|
97
100
|
return _ref2.apply(this, arguments);
|
|
98
101
|
};
|
|
99
|
-
}(), []);
|
|
102
|
+
}(), [t]);
|
|
100
103
|
/**
|
|
101
104
|
* 点赞/点踩
|
|
102
105
|
*/
|
|
@@ -126,7 +129,7 @@ export var usePureChatActions = function usePureChatActions() {
|
|
|
126
129
|
dispatch(setMessageList({
|
|
127
130
|
messageList: newMessageList
|
|
128
131
|
}));
|
|
129
|
-
Toast.success(mark === 2 ? '
|
|
132
|
+
Toast.success(mark === 2 ? t('action.likeDone') : mark === 1 ? t('action.dislikeDone') : item.mark === 2 ? t('action.likeCancel') : t('action.dislikeCancel'));
|
|
130
133
|
_context2.next = 9;
|
|
131
134
|
return handleMark(params);
|
|
132
135
|
case 9:
|
|
@@ -139,7 +142,7 @@ export var usePureChatActions = function usePureChatActions() {
|
|
|
139
142
|
case 13:
|
|
140
143
|
_context2.prev = 13;
|
|
141
144
|
_context2.t0 = _context2["catch"](3);
|
|
142
|
-
Toast.error('
|
|
145
|
+
Toast.error(t('action.failed'));
|
|
143
146
|
case 16:
|
|
144
147
|
case "end":
|
|
145
148
|
return _context2.stop();
|
|
@@ -149,7 +152,7 @@ export var usePureChatActions = function usePureChatActions() {
|
|
|
149
152
|
return function (_x2, _x3) {
|
|
150
153
|
return _ref3.apply(this, arguments);
|
|
151
154
|
};
|
|
152
|
-
}(), []);
|
|
155
|
+
}(), [t]);
|
|
153
156
|
return {
|
|
154
157
|
copyToClipboard: copyToClipboard,
|
|
155
158
|
handleUnlove: handleUnlove
|
|
@@ -18,6 +18,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
18
18
|
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; } }
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
20
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
21
|
+
import { useTranslation } from 'react-i18next';
|
|
21
22
|
import { useAppDispatch, useAppSelector } from "../store/hooks";
|
|
22
23
|
import { setMessageList } from "../store/slices/gimiMenuSlice";
|
|
23
24
|
import { useContext } from 'react';
|
|
@@ -27,6 +28,8 @@ import { useChatRecommend } from "./useChatRecommend";
|
|
|
27
28
|
import { Toast } from '@douyinfe/semi-ui';
|
|
28
29
|
import { throttle } from 'lodash';
|
|
29
30
|
var useChatHistory = function useChatHistory(checkUnfinishedMessage, scrollBottomForce, containerRef) {
|
|
31
|
+
var _useTranslation = useTranslation(),
|
|
32
|
+
t = _useTranslation.t;
|
|
30
33
|
var dispatch = useAppDispatch();
|
|
31
34
|
var _useChatRecommend = useChatRecommend(),
|
|
32
35
|
rewriteRecommendListFormHistory = _useChatRecommend.rewriteRecommendListFormHistory;
|
|
@@ -223,7 +226,7 @@ var useChatHistory = function useChatHistory(checkUnfinishedMessage, scrollBotto
|
|
|
223
226
|
break;
|
|
224
227
|
case 38:
|
|
225
228
|
if (res.status === 1034) {
|
|
226
|
-
Toast.error(res.message || '
|
|
229
|
+
Toast.error(res.message || t('history.fetchFailed'));
|
|
227
230
|
}
|
|
228
231
|
case 39:
|
|
229
232
|
isMoreLoadingRef.current = false;
|