@myun/gimi-chat 0.9.6 → 0.9.7
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
|
@@ -12,6 +12,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
12
12
|
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; } }
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
15
16
|
import { Modal, Popover, Button, Spin, Toast } from '@douyinfe/semi-ui';
|
|
16
17
|
// import { removeChat } from '@/apis/gimi';
|
|
17
18
|
import classNames from 'classnames';
|
|
@@ -26,6 +27,8 @@ var hostoryItemIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/2
|
|
|
26
27
|
var chatlistHover = 'https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202601/23/9a669_20260123133853.png';
|
|
27
28
|
var chatlistIcon = 'https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202601/23/e9b4a_20260123133925.png';
|
|
28
29
|
var HistoryList = function HistoryList() {
|
|
30
|
+
var _useTranslation = useTranslation(),
|
|
31
|
+
t = _useTranslation.t;
|
|
29
32
|
var _useAppSelector = useAppSelector(function (state) {
|
|
30
33
|
return state.gimiMenu;
|
|
31
34
|
}),
|
|
@@ -111,10 +114,10 @@ var HistoryList = function HistoryList() {
|
|
|
111
114
|
e.stopPropagation();
|
|
112
115
|
confirm({
|
|
113
116
|
icon: '',
|
|
114
|
-
content: '
|
|
115
|
-
title: '
|
|
116
|
-
okText: '
|
|
117
|
-
cancelText: '
|
|
117
|
+
content: t('history.deleteModal.content'),
|
|
118
|
+
title: t('history.deleteModal.title'),
|
|
119
|
+
okText: t('common.delete'),
|
|
120
|
+
cancelText: t('common.cancel'),
|
|
118
121
|
centered: true,
|
|
119
122
|
closable: true,
|
|
120
123
|
okButtonProps: {
|
|
@@ -151,7 +154,7 @@ var HistoryList = function HistoryList() {
|
|
|
151
154
|
case 3:
|
|
152
155
|
res = _context2.sent;
|
|
153
156
|
if (res && res.status == 0) {
|
|
154
|
-
Toast.success('
|
|
157
|
+
Toast.success(t('history.deleteSuccess'));
|
|
155
158
|
if (id === conversationId) {
|
|
156
159
|
dispatch({
|
|
157
160
|
type: 'gimiMenu/setConversationId',
|
|
@@ -167,7 +170,7 @@ var HistoryList = function HistoryList() {
|
|
|
167
170
|
onRefresh();
|
|
168
171
|
}
|
|
169
172
|
} else {
|
|
170
|
-
Toast.error('
|
|
173
|
+
Toast.error(t('history.deleteFailed'));
|
|
171
174
|
}
|
|
172
175
|
_context2.next = 9;
|
|
173
176
|
break;
|
|
@@ -207,7 +210,7 @@ var HistoryList = function HistoryList() {
|
|
|
207
210
|
className: styles.iconMore
|
|
208
211
|
}), /*#__PURE__*/React.createElement("span", {
|
|
209
212
|
className: styles.deltext
|
|
210
|
-
},
|
|
213
|
+
}, t('common.delete')));
|
|
211
214
|
};
|
|
212
215
|
useEffect(function () {
|
|
213
216
|
if (baseUrl) dispatch(getChatHistoryList({
|
|
@@ -269,9 +272,9 @@ var HistoryList = function HistoryList() {
|
|
|
269
272
|
style: {
|
|
270
273
|
marginLeft: 8
|
|
271
274
|
}
|
|
272
|
-
},
|
|
275
|
+
}, t('common.loading'))), !hasMore && historyList.length > 10 && /*#__PURE__*/React.createElement("div", {
|
|
273
276
|
className: styles.no_more
|
|
274
|
-
},
|
|
277
|
+
}, t('history.noMore'))) : loading ? /*#__PURE__*/React.createElement("div", {
|
|
275
278
|
className: styles.loading
|
|
276
279
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
277
280
|
size: "small"
|
|
@@ -279,8 +282,8 @@ var HistoryList = function HistoryList() {
|
|
|
279
282
|
style: {
|
|
280
283
|
marginLeft: 8
|
|
281
284
|
}
|
|
282
|
-
},
|
|
285
|
+
}, t('common.loading'))) : /*#__PURE__*/React.createElement("div", {
|
|
283
286
|
className: styles.empty
|
|
284
|
-
},
|
|
287
|
+
}, t('history.empty')));
|
|
285
288
|
};
|
|
286
289
|
export default HistoryList;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import "./index.css";
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import addChat from "../../../assets/image/addChat.png";
|
|
4
5
|
import HistoryList from "../history-list";
|
|
5
6
|
import classNames from 'classnames';
|
|
@@ -12,6 +13,8 @@ var Slider = function Slider(_ref) {
|
|
|
12
13
|
showHistory = _ref$showHistory === void 0 ? true : _ref$showHistory,
|
|
13
14
|
_ref$showAddNew = _ref.showAddNew,
|
|
14
15
|
showAddNew = _ref$showAddNew === void 0 ? true : _ref$showAddNew;
|
|
16
|
+
var _useTranslation = useTranslation(),
|
|
17
|
+
t = _useTranslation.t;
|
|
15
18
|
var _useAppSelector = useAppSelector(function (state) {
|
|
16
19
|
return state.gimiMenu;
|
|
17
20
|
}),
|
|
@@ -42,7 +45,7 @@ var Slider = function Slider(_ref) {
|
|
|
42
45
|
alt: ""
|
|
43
46
|
}), /*#__PURE__*/React.createElement("span", {
|
|
44
47
|
className: "newChatText"
|
|
45
|
-
},
|
|
48
|
+
}, t('slider.newConversation'))), showHistory && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
46
49
|
className: "line"
|
|
47
50
|
}), /*#__PURE__*/React.createElement("div", {
|
|
48
51
|
className: "recent_text"
|
|
@@ -53,6 +56,6 @@ var Slider = function Slider(_ref) {
|
|
|
53
56
|
style: {
|
|
54
57
|
margin: '0px 8px'
|
|
55
58
|
}
|
|
56
|
-
}), /*#__PURE__*/React.createElement("span", null,
|
|
59
|
+
}), /*#__PURE__*/React.createElement("span", null, t('slider.recentConversations'))), /*#__PURE__*/React.createElement(HistoryList, null))));
|
|
57
60
|
};
|
|
58
61
|
export default Slider;
|
|
@@ -4,18 +4,22 @@ import { Provider } from 'react-redux';
|
|
|
4
4
|
import Chat from "../core/chat";
|
|
5
5
|
import ChatContext from "../../components/templates/chatContext";
|
|
6
6
|
import useApi from "../../apis/useApi";
|
|
7
|
+
import { GimiChatI18nProvider } from "../../i18n";
|
|
7
8
|
var Index = function Index(props) {
|
|
8
|
-
var _props$chat, _props$chat2;
|
|
9
|
+
var _props$chat, _props$chat2, _props$chat3, _props$chat4;
|
|
9
10
|
var apiService = useApi(((_props$chat = props.chat) === null || _props$chat === void 0 ? void 0 : _props$chat.baseUrl) || '', ((_props$chat2 = props.chat) === null || _props$chat2 === void 0 ? void 0 : _props$chat2.token) || '');
|
|
10
11
|
var store = useMemo(function () {
|
|
11
12
|
return createStore();
|
|
12
13
|
}, []);
|
|
13
14
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
14
15
|
store: store
|
|
16
|
+
}, /*#__PURE__*/React.createElement(GimiChatI18nProvider, {
|
|
17
|
+
locale: (_props$chat3 = props.chat) === null || _props$chat3 === void 0 ? void 0 : _props$chat3.locale,
|
|
18
|
+
messages: (_props$chat4 = props.chat) === null || _props$chat4 === void 0 ? void 0 : _props$chat4.localeMessages
|
|
15
19
|
}, /*#__PURE__*/React.createElement(ChatContext.Provider, {
|
|
16
20
|
value: {
|
|
17
21
|
apiService: apiService
|
|
18
22
|
}
|
|
19
|
-
}, /*#__PURE__*/React.createElement(Chat, props)));
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Chat, props))));
|
|
20
24
|
};
|
|
21
25
|
export default Index;
|
|
@@ -19,6 +19,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
19
19
|
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; } }
|
|
20
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
21
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
22
|
+
import { useTranslation } from 'react-i18next';
|
|
22
23
|
import LottieImg from "../lottie-img";
|
|
23
24
|
import styles from "./index.module.css";
|
|
24
25
|
import classNames from 'classnames';
|
|
@@ -43,6 +44,8 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
43
44
|
setSpeech = _ref.setSpeech,
|
|
44
45
|
_ref$handleHangUp = _ref.handleHangUp,
|
|
45
46
|
handleHangUp = _ref$handleHangUp === void 0 ? function () {} : _ref$handleHangUp;
|
|
47
|
+
var _useTranslation = useTranslation(),
|
|
48
|
+
t = _useTranslation.t;
|
|
46
49
|
var _useState = useState(true),
|
|
47
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
51
|
showCaptions = _useState2[0],
|
|
@@ -51,7 +54,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
51
54
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
55
|
isDisable = _useState4[0],
|
|
53
56
|
setIsDisable = _useState4[1];
|
|
54
|
-
var _useState5 = useState('
|
|
57
|
+
var _useState5 = useState(t('aiDialogue.newConversation')),
|
|
55
58
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
56
59
|
headerTitle = _useState6[0],
|
|
57
60
|
setHeaderTitle = _useState6[1];
|
|
@@ -130,10 +133,10 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
130
133
|
if (!audioEnabled) {
|
|
131
134
|
if (isThinking) return /*#__PURE__*/React.createElement("div", {
|
|
132
135
|
className: styles.statusText
|
|
133
|
-
}, '
|
|
136
|
+
}, t('aiDialogue.mutedThinking'), " ");
|
|
134
137
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
138
|
className: styles.statusText
|
|
136
|
-
}, '
|
|
139
|
+
}, t('aiDialogue.muted'));
|
|
137
140
|
}
|
|
138
141
|
switch (status) {
|
|
139
142
|
case 0:
|
|
@@ -142,7 +145,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
142
145
|
size: [30, 50]
|
|
143
146
|
}), /*#__PURE__*/React.createElement("div", {
|
|
144
147
|
className: styles.statusText
|
|
145
|
-
},
|
|
148
|
+
}, t('aiDialogue.connecting')));
|
|
146
149
|
case 1:
|
|
147
150
|
case 6:
|
|
148
151
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LottieImg, {
|
|
@@ -150,7 +153,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
150
153
|
size: [34, 60]
|
|
151
154
|
}), /*#__PURE__*/React.createElement("div", {
|
|
152
155
|
className: styles.statusText
|
|
153
|
-
},
|
|
156
|
+
}, t('aiDialogue.listening')));
|
|
154
157
|
case 2:
|
|
155
158
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
156
159
|
className: styles.statusImg
|
|
@@ -160,31 +163,31 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
160
163
|
className: styles.iconInside
|
|
161
164
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
162
165
|
className: styles.statusText
|
|
163
|
-
},
|
|
166
|
+
}, t('aiDialogue.interrupt')));
|
|
164
167
|
case 4:
|
|
165
168
|
// 网络错误状态打断TextLoading
|
|
166
169
|
setIsTextLoading(false);
|
|
167
170
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
168
171
|
className: classNames(styles.statusText, styles.danger, styles.pointer)
|
|
169
|
-
},
|
|
172
|
+
}, t('aiDialogue.reconnect')));
|
|
170
173
|
case 5:
|
|
171
174
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LottieImg, {
|
|
172
175
|
name: "aiOutputLoading",
|
|
173
176
|
size: [34, 60]
|
|
174
177
|
}), /*#__PURE__*/React.createElement("div", {
|
|
175
178
|
className: styles.statusText
|
|
176
|
-
},
|
|
179
|
+
}, t('aiDialogue.startSpeaking')));
|
|
177
180
|
case 7:
|
|
178
181
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LottieImg, {
|
|
179
182
|
name: "aiOutputLoading",
|
|
180
183
|
size: [34, 60]
|
|
181
184
|
}), /*#__PURE__*/React.createElement("div", {
|
|
182
185
|
className: styles.statusText
|
|
183
|
-
},
|
|
186
|
+
}, t('aiDialogue.thinking')));
|
|
184
187
|
default:
|
|
185
188
|
return null;
|
|
186
189
|
}
|
|
187
|
-
}, [status, audioEnabled, isThinking]);
|
|
190
|
+
}, [status, audioEnabled, isThinking, t]);
|
|
188
191
|
|
|
189
192
|
/**
|
|
190
193
|
* 拆分混杂字符串中的「纯文字内容」和「moduleType开头的JSON对象」
|
|
@@ -277,7 +280,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
277
280
|
_context.next = 3;
|
|
278
281
|
break;
|
|
279
282
|
}
|
|
280
|
-
Toast.error('
|
|
283
|
+
Toast.error(t('aiDialogue.networkError'));
|
|
281
284
|
return _context.abrupt("return");
|
|
282
285
|
case 3:
|
|
283
286
|
enable = flag === undefined ? audioEnabled : flag;
|
|
@@ -405,7 +408,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
405
408
|
showMicWarning: true
|
|
406
409
|
}
|
|
407
410
|
});
|
|
408
|
-
throw new Error('
|
|
411
|
+
throw new Error(t('aiDialogue.micPermissionRequired'));
|
|
409
412
|
case 9:
|
|
410
413
|
_context2.next = 11;
|
|
411
414
|
return getRtcConfig();
|
|
@@ -521,7 +524,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
521
524
|
unsupportedShownRef.current = true;
|
|
522
525
|
}
|
|
523
526
|
Toast.warning({
|
|
524
|
-
content: '
|
|
527
|
+
content: t('aiDialogue.unsupportedCall'),
|
|
525
528
|
duration: 0,
|
|
526
529
|
style: {
|
|
527
530
|
marginTop: '30vh'
|
|
@@ -672,11 +675,11 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
672
675
|
_context4.prev = 9;
|
|
673
676
|
_context4.t0 = _context4["catch"](0);
|
|
674
677
|
setStatus(4); // 状态4:连接失败,提示「点击重新连接」
|
|
675
|
-
if (!((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message) === '
|
|
678
|
+
if (!((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message) === t('aiDialogue.micPermissionRequired'))) {
|
|
676
679
|
_context4.next = 15;
|
|
677
680
|
break;
|
|
678
681
|
}
|
|
679
|
-
Toast.error('
|
|
682
|
+
Toast.error(t('aiDialogue.micPermissionDenied'));
|
|
680
683
|
return _context4.abrupt("return");
|
|
681
684
|
case 15:
|
|
682
685
|
Toast.error(_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message);
|
|
@@ -725,7 +728,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
725
728
|
var clickInterrupt = debounce(function () {
|
|
726
729
|
// 校验1:检查网络是否在线
|
|
727
730
|
if (!navigator.onLine) {
|
|
728
|
-
Toast.error('
|
|
731
|
+
Toast.error(t('aiDialogue.networkError'));
|
|
729
732
|
return;
|
|
730
733
|
}
|
|
731
734
|
// 校验2:检查当前状态是否为“连接失败(status=4)”
|
|
@@ -895,14 +898,14 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
895
898
|
var isInCall = !!clientRef.current && status !== 4;
|
|
896
899
|
if (!isInCall) return;
|
|
897
900
|
e.preventDefault();
|
|
898
|
-
e.returnValue = '
|
|
901
|
+
e.returnValue = t('aiDialogue.reloadConfirm');
|
|
899
902
|
return e.returnValue;
|
|
900
903
|
};
|
|
901
904
|
window.addEventListener('beforeunload', handleBeforeUnload);
|
|
902
905
|
return function () {
|
|
903
906
|
return window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
904
907
|
};
|
|
905
|
-
}, [status]);
|
|
908
|
+
}, [status, t]);
|
|
906
909
|
useEffect(function () {
|
|
907
910
|
// 监听页面可见性变化(比如用户切到其他标签页)
|
|
908
911
|
var handleVisibilityChange = /*#__PURE__*/function () {
|
|
@@ -942,7 +945,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
942
945
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
943
946
|
while (1) switch (_context9.prev = _context9.next) {
|
|
944
947
|
case 0:
|
|
945
|
-
Toast.error('
|
|
948
|
+
Toast.error(t('aiDialogue.networkError'));
|
|
946
949
|
_context9.next = 3;
|
|
947
950
|
return handleDisconnect();
|
|
948
951
|
case 3:
|
|
@@ -983,7 +986,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
983
986
|
placement: "bottom",
|
|
984
987
|
visible: showWordsTooltip,
|
|
985
988
|
onVisibleChange: setShowWordsTooltip,
|
|
986
|
-
content: showCaptions ? '
|
|
989
|
+
content: showCaptions ? t('aiDialogue.closeCaptions') : t('aiDialogue.openCaptions'),
|
|
987
990
|
overlayClassName: "ai-chat-tooltip"
|
|
988
991
|
}, /*#__PURE__*/React.createElement("div", {
|
|
989
992
|
className: styles.iconWrap
|
|
@@ -1007,7 +1010,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
1007
1010
|
className: styles.container
|
|
1008
1011
|
}, showCaptions ? status === 5 || status === 6 ? /*#__PURE__*/React.createElement("div", {
|
|
1009
1012
|
className: styles.tips
|
|
1010
|
-
}, status === 5 ? '
|
|
1013
|
+
}, status === 5 ? t('aiDialogue.pleaseSpeak') : t('aiDialogue.listeningEllipsis')) : /*#__PURE__*/React.createElement("div", null, messageList.map(function (item) {
|
|
1011
1014
|
return /*#__PURE__*/React.createElement("div", {
|
|
1012
1015
|
className: classNames(styles.item, _defineProperty({}, styles.answer, item.type === 'answer')),
|
|
1013
1016
|
key: item.id
|
|
@@ -1029,7 +1032,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
1029
1032
|
placement: "top",
|
|
1030
1033
|
visible: showMuteTooltip,
|
|
1031
1034
|
onVisibleChange: setShowMuteTooltip,
|
|
1032
|
-
content: audioEnabled ? '
|
|
1035
|
+
content: audioEnabled ? t('aiDialogue.closeMic') : t('aiDialogue.openMic'),
|
|
1033
1036
|
overlayClassName: "ai-chat-tooltip"
|
|
1034
1037
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1035
1038
|
className: classNames(styles.btnItem, isDisable ? styles.disable : ''),
|
|
@@ -1044,7 +1047,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
1044
1047
|
placement: "top",
|
|
1045
1048
|
visible: showHangUpTooltip,
|
|
1046
1049
|
onVisibleChange: setShowHangUpTooltip,
|
|
1047
|
-
content: '
|
|
1050
|
+
content: t('aiDialogue.hangUp'),
|
|
1048
1051
|
overlayClassName: "ai-chat-tooltip"
|
|
1049
1052
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1050
1053
|
className: styles.btnItem,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import styles from "./index.module.css";
|
|
3
4
|
import LottieImg from "../lottie-img";
|
|
4
5
|
var AiLoading = function AiLoading() {
|
|
6
|
+
var _useTranslation = useTranslation(),
|
|
7
|
+
t = _useTranslation.t;
|
|
5
8
|
return /*#__PURE__*/React.createElement("div", {
|
|
6
9
|
className: styles.aiLoading
|
|
7
10
|
}, /*#__PURE__*/React.createElement(LottieImg, {
|
|
@@ -9,6 +12,6 @@ var AiLoading = function AiLoading() {
|
|
|
9
12
|
size: [30, 50]
|
|
10
13
|
}), /*#__PURE__*/React.createElement("div", {
|
|
11
14
|
className: styles.text
|
|
12
|
-
},
|
|
15
|
+
}, t('common.dataLoading')));
|
|
13
16
|
};
|
|
14
17
|
export default AiLoading;
|
|
@@ -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 classNames from 'classnames';
|
|
4
5
|
import ReasoningContent from "../reasoning-content/index";
|
|
@@ -48,6 +49,8 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
48
49
|
enableVoicePlay = _ref$enableVoicePlay === void 0 ? true : _ref$enableVoicePlay,
|
|
49
50
|
reasoningTitle = _ref.reasoningTitle,
|
|
50
51
|
model = _ref.model;
|
|
52
|
+
var _useTranslation = useTranslation(),
|
|
53
|
+
t = _useTranslation.t;
|
|
51
54
|
var isMsgRecieving = useAppSelector(function (state) {
|
|
52
55
|
return state.gimiMenu.isMsgRecieving;
|
|
53
56
|
});
|
|
@@ -142,7 +145,7 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
142
145
|
className: styles.checkIcon
|
|
143
146
|
}), /*#__PURE__*/React.createElement("span", {
|
|
144
147
|
className: styles.checkText
|
|
145
|
-
},
|
|
148
|
+
}, t('answer.taskCompleted'))), showContentFlag && /*#__PURE__*/React.createElement(MMarkdown, {
|
|
146
149
|
content: processString(item.content || ''),
|
|
147
150
|
customRender: customRender,
|
|
148
151
|
showLoading: item.loading
|
|
@@ -158,7 +161,7 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
158
161
|
onFailure: onFailure
|
|
159
162
|
}), item.stop === 1 && /*#__PURE__*/React.createElement("div", {
|
|
160
163
|
className: styles.stop
|
|
161
|
-
},
|
|
164
|
+
}, t('answer.stopped')), showOperation && /*#__PURE__*/React.createElement("div", {
|
|
162
165
|
className: styles.opera
|
|
163
166
|
}, (showOpera === null || showOpera === void 0 ? void 0 : showOpera(item.id)) && !item.loading && /*#__PURE__*/React.createElement("div", {
|
|
164
167
|
className: styles.opera_item
|
|
@@ -195,14 +198,14 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
195
198
|
className: styles.course_recommend_header
|
|
196
199
|
}, /*#__PURE__*/React.createElement("div", {
|
|
197
200
|
className: styles.course_recommend_header_title
|
|
198
|
-
},
|
|
201
|
+
}, t('answer.courseRecommend')), (item.relatedCourseRecommendation || []).length > 4 && /*#__PURE__*/React.createElement("div", {
|
|
199
202
|
className: styles.course_recommend_header_more,
|
|
200
203
|
onClick: function onClick() {
|
|
201
204
|
handleShowCourse(item);
|
|
202
205
|
}
|
|
203
206
|
}, /*#__PURE__*/React.createElement("span", {
|
|
204
207
|
className: styles.all
|
|
205
|
-
},
|
|
208
|
+
}, t('answer.allCourses')))), /*#__PURE__*/React.createElement("div", {
|
|
206
209
|
className: styles.course_recommend_list
|
|
207
210
|
}, (item.relatedCourseRecommendation || []).map(function (course, i) {
|
|
208
211
|
if (i > 3) return null;
|
|
@@ -9,11 +9,14 @@ import styles from "./index.module.css";
|
|
|
9
9
|
import { MMarkdown } from '@myun/gimi-design';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import FileUpload from "../file-upload";
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
12
13
|
var AskCard = function AskCard(_ref) {
|
|
13
14
|
var item = _ref.item,
|
|
14
15
|
moduleInfo = _ref.moduleInfo,
|
|
15
16
|
handleClickAskList = _ref.handleClickAskList,
|
|
16
17
|
onAskCardCallback = _ref.onAskCardCallback;
|
|
18
|
+
var _useTranslation = useTranslation(),
|
|
19
|
+
t = _useTranslation.t;
|
|
17
20
|
var _React$useState = React.useState(false),
|
|
18
21
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
19
22
|
disabled = _React$useState2[0],
|
|
@@ -81,11 +84,11 @@ var AskCard = function AskCard(_ref) {
|
|
|
81
84
|
className: classNames(styles.uploadIcon)
|
|
82
85
|
}, /*#__PURE__*/React.createElement("img", {
|
|
83
86
|
src: item.disableUploadFile ? 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/19/b1e04_20250919162201.png' : 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/11/83ad4_20250911153220.png',
|
|
84
|
-
alt:
|
|
87
|
+
alt: t('askCard.fileUpload')
|
|
85
88
|
}), /*#__PURE__*/React.createElement("span", {
|
|
86
89
|
style: item.disableUploadFile ? {
|
|
87
90
|
color: '#d9dce5'
|
|
88
91
|
} : {}
|
|
89
|
-
},
|
|
92
|
+
}, t('askCard.fileUpload'))))));
|
|
90
93
|
};
|
|
91
94
|
export default AskCard;
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.showUpload {
|
|
80
|
-
width:
|
|
80
|
+
width: fit-content;
|
|
81
|
+
min-width: 128px;
|
|
81
82
|
height: 44px;
|
|
82
83
|
flex-shrink: 0;
|
|
83
84
|
border-radius: 22px;
|
|
@@ -89,6 +90,8 @@
|
|
|
89
90
|
cursor: pointer;
|
|
90
91
|
display: flex;
|
|
91
92
|
align-items: center;
|
|
93
|
+
padding: 0 12px;
|
|
94
|
+
box-sizing: border-box;
|
|
92
95
|
color: #000;
|
|
93
96
|
font-family: "PingFang SC";
|
|
94
97
|
font-size: 14px;
|
|
@@ -103,6 +106,10 @@
|
|
|
103
106
|
height: 100%;
|
|
104
107
|
display: flex;
|
|
105
108
|
align-items: center;
|
|
109
|
+
gap: 6px;
|
|
110
|
+
}
|
|
111
|
+
.showUpload .uploadIcon span {
|
|
112
|
+
white-space: nowrap;
|
|
106
113
|
}
|
|
107
114
|
.showUpload .disableFile {
|
|
108
115
|
border-radius: 22px;
|
|
@@ -16,6 +16,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
16
16
|
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; } }
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
import React, { useContext } from "react";
|
|
19
|
+
import { useTranslation } from 'react-i18next';
|
|
19
20
|
import { AIChatInput, Divider } from '@douyinfe/semi-ui';
|
|
20
21
|
import { transformToInputSlots } from "../../utils/chatInputUtil";
|
|
21
22
|
import VoiceCheckDialog from "../voice-check-dialog";
|
|
@@ -51,6 +52,8 @@ var extractText = function extractText() {
|
|
|
51
52
|
};
|
|
52
53
|
var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
53
54
|
var _messageList;
|
|
55
|
+
var _useTranslation = useTranslation(),
|
|
56
|
+
t = _useTranslation.t;
|
|
54
57
|
var fileList = useAppSelector(function (state) {
|
|
55
58
|
return state.gimiMenu.fileList;
|
|
56
59
|
});
|
|
@@ -137,7 +140,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
137
140
|
var value = extractText(content);
|
|
138
141
|
if (value.length > 10000) {
|
|
139
142
|
var _inputRef$current4;
|
|
140
|
-
Toast.warning('
|
|
143
|
+
Toast.warning(t('chatInput.maxLength'));
|
|
141
144
|
value = value.slice(0, 10000);
|
|
142
145
|
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.setContent(value);
|
|
143
146
|
}
|
|
@@ -185,9 +188,9 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
185
188
|
}, [props.asrText, props.isRecording, props.isVoiceGetting, handleQuickInput]);
|
|
186
189
|
var handleTip = function handleTip() {
|
|
187
190
|
if ((fileList === null || fileList === void 0 ? void 0 : fileList.length) > 0) {
|
|
188
|
-
return Toast.info('
|
|
191
|
+
return Toast.info(t('chatInput.uploadLimitOne'));
|
|
189
192
|
}
|
|
190
|
-
return Toast.info('
|
|
193
|
+
return Toast.info(t('chatInput.flowUnsupported'));
|
|
191
194
|
};
|
|
192
195
|
var UploadFileTool = React.useMemo(function () {
|
|
193
196
|
if (!props.enableFileUpload || (agentObj === null || agentObj === void 0 ? void 0 : agentObj.openUploadFile) === 0) {
|
|
@@ -200,7 +203,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
200
203
|
disabled: shouldDisableUploadFile,
|
|
201
204
|
onFileUploaded: props.onFileUploaded
|
|
202
205
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
203
|
-
content: '
|
|
206
|
+
content: t('chatInput.uploadFile')
|
|
204
207
|
}, shouldDisableUploadFile ? /*#__PURE__*/React.createElement("div", {
|
|
205
208
|
className: styles.uploadIcon,
|
|
206
209
|
onClick: handleTip,
|
|
@@ -226,7 +229,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
226
229
|
_context.next = 2;
|
|
227
230
|
break;
|
|
228
231
|
}
|
|
229
|
-
return _context.abrupt("return", Toast.warning('
|
|
232
|
+
return _context.abrupt("return", Toast.warning(t('chatInput.voiceCallUnsupported')));
|
|
230
233
|
case 2:
|
|
231
234
|
_context.prev = 2;
|
|
232
235
|
_context.next = 5;
|
|
@@ -234,7 +237,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
234
237
|
audio: true
|
|
235
238
|
});
|
|
236
239
|
case 5:
|
|
237
|
-
_context.next =
|
|
240
|
+
_context.next = 12;
|
|
238
241
|
break;
|
|
239
242
|
case 7:
|
|
240
243
|
_context.prev = 7;
|
|
@@ -245,23 +248,24 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
245
248
|
showMicWarning: true
|
|
246
249
|
}
|
|
247
250
|
});
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
console.error(t('chatInput.micPermissionRequired'));
|
|
252
|
+
return _context.abrupt("return");
|
|
253
|
+
case 12:
|
|
250
254
|
if (conversationIdRef.current) {
|
|
251
|
-
_context.next =
|
|
255
|
+
_context.next = 26;
|
|
252
256
|
break;
|
|
253
257
|
}
|
|
254
258
|
params = _objectSpread({
|
|
255
|
-
content: '
|
|
259
|
+
content: t('chatInput.newConversation'),
|
|
256
260
|
conversationType: agentObjRef.current.conversationType,
|
|
257
261
|
botId: agentObjRef.current.botId,
|
|
258
262
|
isSystemAuto: 1,
|
|
259
263
|
preview: props.platform === 'preview' ? 1 : 0
|
|
260
264
|
}, businessParams);
|
|
261
|
-
_context.prev =
|
|
262
|
-
_context.next =
|
|
265
|
+
_context.prev = 14;
|
|
266
|
+
_context.next = 17;
|
|
263
267
|
return createRoomId(params);
|
|
264
|
-
case
|
|
268
|
+
case 17:
|
|
265
269
|
res = _context.sent;
|
|
266
270
|
if (res && res.status === 0) {
|
|
267
271
|
// 关闭自动加载会话,避免重复加载
|
|
@@ -276,23 +280,23 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
276
280
|
} else {
|
|
277
281
|
Toast.error(res.message);
|
|
278
282
|
}
|
|
279
|
-
_context.next =
|
|
283
|
+
_context.next = 24;
|
|
280
284
|
break;
|
|
281
|
-
case
|
|
282
|
-
_context.prev =
|
|
283
|
-
_context.t1 = _context["catch"](
|
|
285
|
+
case 21:
|
|
286
|
+
_context.prev = 21;
|
|
287
|
+
_context.t1 = _context["catch"](14);
|
|
284
288
|
console.log('error', _context.t1);
|
|
285
|
-
case
|
|
286
|
-
_context.next =
|
|
289
|
+
case 24:
|
|
290
|
+
_context.next = 27;
|
|
287
291
|
break;
|
|
288
|
-
case
|
|
292
|
+
case 26:
|
|
289
293
|
// 直接打开会话
|
|
290
294
|
setShowChatCommunication(true);
|
|
291
|
-
case
|
|
295
|
+
case 27:
|
|
292
296
|
case "end":
|
|
293
297
|
return _context.stop();
|
|
294
298
|
}
|
|
295
|
-
}, _callee, null, [[2, 7], [
|
|
299
|
+
}, _callee, null, [[2, 7], [14, 21]]);
|
|
296
300
|
})), [dispatch, isMsgRecieving, props, businessParams]);
|
|
297
301
|
var stopRecording = React.useCallback( /*#__PURE__*/function () {
|
|
298
302
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(enableInput) {
|
|
@@ -359,7 +363,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
359
363
|
var renderConfigureArea = React.useCallback(function () {
|
|
360
364
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
361
365
|
trigger: 'click',
|
|
362
|
-
content:
|
|
366
|
+
content: t('chatInput.deepThinkTip')
|
|
363
367
|
}, /*#__PURE__*/React.createElement("div", {
|
|
364
368
|
className: styles.deepthink
|
|
365
369
|
}, /*#__PURE__*/React.createElement("img", {
|
|
@@ -367,7 +371,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
367
371
|
src: deepThinkActive,
|
|
368
372
|
className: styles.imgs,
|
|
369
373
|
alt: ""
|
|
370
|
-
}), /*#__PURE__*/React.createElement("span", null,
|
|
374
|
+
}), /*#__PURE__*/React.createElement("span", null, t('chatInput.deepThinkModeAuto'))));
|
|
371
375
|
}, []);
|
|
372
376
|
var stopSSe = function stopSSe() {
|
|
373
377
|
if (uploadFileRef.current) {
|
|
@@ -422,7 +426,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
422
426
|
style: {
|
|
423
427
|
flex: 1
|
|
424
428
|
}
|
|
425
|
-
},
|
|
429
|
+
}, t('chatInput.fetchingVoice'))));
|
|
426
430
|
}, [fileList, props.isRecording, props.isVoiceGetting, messageList, quoteProductList, quoteTeachModelList, handleDelFile, handleReTry, isAskProcess]);
|
|
427
431
|
var handleHangUp = function handleHangUp() {
|
|
428
432
|
var continueFlag = true;
|