@myun/gimi-chat 0.5.8 → 0.6.0
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/apis/useApi.d.ts +3 -0
- package/dist/apis/useApi.js +70 -1
- package/dist/components/answer-item/index.js +10 -5
- package/dist/components/chat-input/index.js +4 -4
- package/dist/components/file-card/fileCardSidebar.d.ts +1 -1
- package/dist/components/file-card/fileCardSidebar.js +22 -30
- package/dist/components/gimi-sidebar/index.d.ts +1 -0
- package/dist/components/gimi-sidebar/index.js +26 -16
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -1
- package/dist/components/knowledge-trace/index.js +24 -31
- package/dist/components/knowledge-trace/videoList.js +1 -1
- package/dist/components/product-tag/index.d.ts +5 -0
- package/dist/components/product-tag/index.js +113 -0
- package/dist/components/product-tag/index.module.css +18 -0
- package/dist/components/quoted-content/index.js +2 -2
- package/dist/components/reasoning-search/sidebar.d.ts +1 -1
- package/dist/components/reasoning-search/sidebar.js +33 -41
- package/dist/components/search-course-list/index.d.ts +38 -0
- package/dist/components/search-course-list/index.js +85 -0
- package/dist/components/search-course-list/index.module.css +149 -0
- package/dist/components/search-course-list/sidebar.d.ts +12 -0
- package/dist/components/search-course-list/sidebar.js +36 -0
- package/dist/components/shadow-loading/index.d.ts +8 -0
- package/dist/components/shadow-loading/index.js +28 -0
- package/dist/components/shadow-loading/index.module.css +18 -0
- package/dist/components/templates/CommonChat.js +57 -15
- package/dist/hooks/useChatHistory.js +7 -7
- package/dist/hooks/useChatStream.js +5 -5
- package/dist/hooks/useCommonChatAPI.d.ts +1 -0
- package/dist/hooks/useCommonChatAPI.js +179 -145
- package/dist/hooks/useSearchCase.d.ts +9 -0
- package/dist/hooks/useSearchCase.js +49 -0
- package/dist/store/slices/gimiMenuSlice.d.ts +2 -2
- package/dist/store/slices/gimiMenuSlice.js +8 -8
- package/dist/types/chat.d.ts +1 -1
- package/dist/umd/index.min.js +1 -1
- package/package.json +1 -1
package/dist/apis/useApi.d.ts
CHANGED
|
@@ -60,6 +60,9 @@ export interface IUseApi {
|
|
|
60
60
|
conversationId: number;
|
|
61
61
|
}) => Promise<FetchResponse<any>>;
|
|
62
62
|
interrupt: (conversationId: number) => Promise<FetchResponse<any>>;
|
|
63
|
+
getSearchCourseList: (query: string) => Promise<FetchResponse<any>>;
|
|
64
|
+
checkProductType: (productId: number) => Promise<FetchResponse<any>>;
|
|
65
|
+
getBusinessAgent: (bussinessType: number) => Promise<FetchResponse<any>>;
|
|
63
66
|
}
|
|
64
67
|
declare const useApi: (baseUrl: string, authToken: string) => IUseApi;
|
|
65
68
|
export default useApi;
|
package/dist/apis/useApi.js
CHANGED
|
@@ -407,6 +407,8 @@ var useApi = function useApi(baseUrl, authToken) {
|
|
|
407
407
|
return _ref21.apply(this, arguments);
|
|
408
408
|
};
|
|
409
409
|
}();
|
|
410
|
+
|
|
411
|
+
// 检查消息是否可以重新生成
|
|
410
412
|
var checkRetry = /*#__PURE__*/function () {
|
|
411
413
|
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
412
414
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
@@ -425,6 +427,70 @@ var useApi = function useApi(baseUrl, authToken) {
|
|
|
425
427
|
return _ref22.apply(this, arguments);
|
|
426
428
|
};
|
|
427
429
|
}();
|
|
430
|
+
|
|
431
|
+
// AI搜索 - 相关课程列表
|
|
432
|
+
var getSearchCourseList = /*#__PURE__*/function () {
|
|
433
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(query) {
|
|
434
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
435
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
436
|
+
case 0:
|
|
437
|
+
return _context22.abrupt("return", fetchService.post('/mcourse/web/search/ai/product', {
|
|
438
|
+
query: query
|
|
439
|
+
}));
|
|
440
|
+
case 1:
|
|
441
|
+
case "end":
|
|
442
|
+
return _context22.stop();
|
|
443
|
+
}
|
|
444
|
+
}, _callee22);
|
|
445
|
+
}));
|
|
446
|
+
return function getSearchCourseList(_x21) {
|
|
447
|
+
return _ref23.apply(this, arguments);
|
|
448
|
+
};
|
|
449
|
+
}();
|
|
450
|
+
|
|
451
|
+
// 检查课程类型
|
|
452
|
+
var checkProductType = /*#__PURE__*/function () {
|
|
453
|
+
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(productId) {
|
|
454
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
455
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
456
|
+
case 0:
|
|
457
|
+
return _context23.abrupt("return", fetchService.get('/mcourse/web/product/type', {
|
|
458
|
+
params: {
|
|
459
|
+
productId: productId
|
|
460
|
+
}
|
|
461
|
+
}));
|
|
462
|
+
case 1:
|
|
463
|
+
case "end":
|
|
464
|
+
return _context23.stop();
|
|
465
|
+
}
|
|
466
|
+
}, _callee23);
|
|
467
|
+
}));
|
|
468
|
+
return function checkProductType(_x22) {
|
|
469
|
+
return _ref24.apply(this, arguments);
|
|
470
|
+
};
|
|
471
|
+
}();
|
|
472
|
+
|
|
473
|
+
// 获取特定业务智能体
|
|
474
|
+
var getBusinessAgent = /*#__PURE__*/function () {
|
|
475
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(businessType) {
|
|
476
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
477
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
478
|
+
case 0:
|
|
479
|
+
return _context24.abrupt("return", fetchService.get('/mcourse/web/agent/queryByBusinessType', {
|
|
480
|
+
params: {
|
|
481
|
+
businessType: businessType
|
|
482
|
+
}
|
|
483
|
+
}));
|
|
484
|
+
case 1:
|
|
485
|
+
case "end":
|
|
486
|
+
return _context24.stop();
|
|
487
|
+
}
|
|
488
|
+
}, _callee24);
|
|
489
|
+
}));
|
|
490
|
+
return function getBusinessAgent(_x23) {
|
|
491
|
+
return _ref25.apply(this, arguments);
|
|
492
|
+
};
|
|
493
|
+
}();
|
|
428
494
|
return {
|
|
429
495
|
getSkillData: getSkillData,
|
|
430
496
|
getProductList: getProductList,
|
|
@@ -447,7 +513,10 @@ var useApi = function useApi(baseUrl, authToken) {
|
|
|
447
513
|
getReferenceVideoList: getReferenceVideoList,
|
|
448
514
|
getReferenceCourseList: getReferenceCourseList,
|
|
449
515
|
checkRetry: checkRetry,
|
|
450
|
-
interrupt: interrupt
|
|
516
|
+
interrupt: interrupt,
|
|
517
|
+
getSearchCourseList: getSearchCourseList,
|
|
518
|
+
checkProductType: checkProductType,
|
|
519
|
+
getBusinessAgent: getBusinessAgent
|
|
451
520
|
};
|
|
452
521
|
};
|
|
453
522
|
export default useApi;
|
|
@@ -7,7 +7,6 @@ import { MMarkdown } from '@myun/gimi-design';
|
|
|
7
7
|
import AskCard from "../ask-card";
|
|
8
8
|
import WorkFlowContent from "../work-flow-content";
|
|
9
9
|
import ExcelSuccessCard from "../excel-components/ExcelSuccessCard";
|
|
10
|
-
import AICorrection from "../ai-correction/index";
|
|
11
10
|
import KnowledgeIconGroup from "../knowledge-trace/KnowledgeIconComponent";
|
|
12
11
|
import ExcelCard from "../excel-components/ExcelCard";
|
|
13
12
|
import { IconTickCircle } from '@douyinfe/semi-icons';
|
|
@@ -17,6 +16,7 @@ import CopyButton from "../message-actions/CopyButton";
|
|
|
17
16
|
import LikeButton from "../message-actions/LikeButton";
|
|
18
17
|
import UnLikeButton from "../message-actions/UnLikeButton";
|
|
19
18
|
import RegenerateButton from "../message-actions/RegenerateButton";
|
|
19
|
+
import ProductTag from "../product-tag";
|
|
20
20
|
var AnswerItem = function AnswerItem(_ref) {
|
|
21
21
|
var _agentDetail$voiceCon;
|
|
22
22
|
var item = _ref.item,
|
|
@@ -83,7 +83,7 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
83
83
|
showTaskSuccess: showTaskSuccess,
|
|
84
84
|
showRegerate: showRegerate
|
|
85
85
|
};
|
|
86
|
-
}, [item.content, item.moduleType, item.moduleInfo, isMsgRecieving, messageList]),
|
|
86
|
+
}, [item.id, item.content, item.moduleType, item.moduleInfo, isMsgRecieving, messageList]),
|
|
87
87
|
showContentFlag = _React$useMemo.showContentFlag,
|
|
88
88
|
showAskTag = _React$useMemo.showAskTag,
|
|
89
89
|
showSkillTag = _React$useMemo.showSkillTag,
|
|
@@ -135,9 +135,14 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
}, {
|
|
138
|
-
type: '
|
|
139
|
-
component:
|
|
140
|
-
}
|
|
138
|
+
type: 'myunproduct',
|
|
139
|
+
component: ProductTag
|
|
140
|
+
}
|
|
141
|
+
// {
|
|
142
|
+
// type: 'correction',
|
|
143
|
+
// component: AICorrection
|
|
144
|
+
// }
|
|
145
|
+
],
|
|
141
146
|
showLoading: item.loading
|
|
142
147
|
}), showAskTag && /*#__PURE__*/React.createElement(AskCard, {
|
|
143
148
|
item: item,
|
|
@@ -71,8 +71,8 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
71
71
|
var quoteTeachModelList = useAppSelector(function (state) {
|
|
72
72
|
return state.gimiMenu.quoteTeachModelList;
|
|
73
73
|
});
|
|
74
|
-
var
|
|
75
|
-
return state.gimiMenu.
|
|
74
|
+
var businessParams = useAppSelector(function (state) {
|
|
75
|
+
return state.gimiMenu.businessParams;
|
|
76
76
|
});
|
|
77
77
|
var dispatch = useAppDispatch();
|
|
78
78
|
var inputWrapRef = React.useRef(null);
|
|
@@ -248,7 +248,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
248
248
|
botId: agentObjRef.current.botId,
|
|
249
249
|
isSystemAuto: 1,
|
|
250
250
|
preview: props.platform === 'preview' ? 1 : 0
|
|
251
|
-
},
|
|
251
|
+
}, businessParams);
|
|
252
252
|
_context.prev = 13;
|
|
253
253
|
_context.next = 16;
|
|
254
254
|
return createRoomId(params);
|
|
@@ -284,7 +284,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
284
284
|
return _context.stop();
|
|
285
285
|
}
|
|
286
286
|
}, _callee, null, [[2, 7], [13, 20]]);
|
|
287
|
-
})), [dispatch, isMsgRecieving, props,
|
|
287
|
+
})), [dispatch, isMsgRecieving, props, businessParams]);
|
|
288
288
|
var stopRecording = React.useCallback( /*#__PURE__*/function () {
|
|
289
289
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(enableInput) {
|
|
290
290
|
var _props$shortAsrClick;
|
|
@@ -3,7 +3,6 @@ import GimiSideBar from "../gimi-sidebar";
|
|
|
3
3
|
import { useAppSelector, useAppDispatch } from "../../store/hooks";
|
|
4
4
|
import { setShowSidebarFileList, setSidebarFileList } from "../../store/slices/gimiMenuSlice";
|
|
5
5
|
import { useCallback } from "react";
|
|
6
|
-
import ReactDOM from 'react-dom';
|
|
7
6
|
import styles from "./index.module.css";
|
|
8
7
|
import { FileCard } from ".";
|
|
9
8
|
var FileCardSideBar = function FileCardSideBar(props) {
|
|
@@ -24,34 +23,27 @@ var FileCardSideBar = function FileCardSideBar(props) {
|
|
|
24
23
|
}));
|
|
25
24
|
dispatch(setSidebarFileList([]));
|
|
26
25
|
}, [dispatch]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
if (isOverFlow) {
|
|
51
|
-
var targetElm = sidebarTargetElm || document.getElementById('myun_gimi_design_chat');
|
|
52
|
-
if (!targetElm) return null;
|
|
53
|
-
return /*#__PURE__*/ReactDOM.createPortal(renderContent(), targetElm);
|
|
54
|
-
}
|
|
55
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, renderContent());
|
|
26
|
+
return /*#__PURE__*/React.createElement(GimiSideBar, {
|
|
27
|
+
show: showSidebar,
|
|
28
|
+
isOverFlow: isOverFlow,
|
|
29
|
+
title: "\u5168\u90E8",
|
|
30
|
+
handleClose: handleClose,
|
|
31
|
+
className: className,
|
|
32
|
+
style: style,
|
|
33
|
+
sidebarTargetElm: sidebarTargetElm
|
|
34
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: styles.list
|
|
36
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
37
|
+
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) {
|
|
39
|
+
return /*#__PURE__*/React.createElement(FileCard, {
|
|
40
|
+
fileName: file.fileName,
|
|
41
|
+
fileType: file.fileType,
|
|
42
|
+
size: file.size,
|
|
43
|
+
downloadUrl: file.downloadUrl,
|
|
44
|
+
key: index,
|
|
45
|
+
model: isOverFlow ? 'sidebar' : 'fullscreen'
|
|
46
|
+
});
|
|
47
|
+
})));
|
|
56
48
|
};
|
|
57
49
|
export default FileCardSideBar;
|
|
@@ -13,5 +13,6 @@ export interface GimiSideBarHandle {
|
|
|
13
13
|
declare const GimiSideBar: React.ForwardRefExoticComponent<IProps & {
|
|
14
14
|
className?: string | undefined;
|
|
15
15
|
style?: React.CSSProperties | undefined;
|
|
16
|
+
sidebarTargetElm?: HTMLElement | undefined;
|
|
16
17
|
} & React.RefAttributes<GimiSideBarHandle>>;
|
|
17
18
|
export default GimiSideBar;
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { IconClose } from "@douyinfe/semi-icons";
|
|
5
5
|
import { Button } from "@douyinfe/semi-ui";
|
|
6
6
|
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
7
|
+
import ReactDOM from "react-dom";
|
|
7
8
|
var GimiSideBar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
8
9
|
var show = _ref.show,
|
|
9
10
|
handleClose = _ref.handleClose,
|
|
@@ -13,7 +14,8 @@ var GimiSideBar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13
14
|
children = _ref.children,
|
|
14
15
|
title = _ref.title,
|
|
15
16
|
className = _ref.className,
|
|
16
|
-
style = _ref.style
|
|
17
|
+
style = _ref.style,
|
|
18
|
+
sidebarTargetElm = _ref.sidebarTargetElm;
|
|
17
19
|
var sideBarRef = useRef(null);
|
|
18
20
|
var contentRef = useRef(null);
|
|
19
21
|
useImperativeHandle(ref, function () {
|
|
@@ -22,20 +24,28 @@ var GimiSideBar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
22
24
|
contentRef: contentRef
|
|
23
25
|
};
|
|
24
26
|
}, [sideBarRef]);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
var renderContent = function renderContent() {
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: classNames(show ? isOverFlow ? styles.overflow_layout : styles.main : styles.closed, className),
|
|
30
|
+
ref: sideBarRef,
|
|
31
|
+
style: style
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: styles.header
|
|
34
|
+
}, /*#__PURE__*/React.createElement("span", null, title), /*#__PURE__*/React.createElement(Button, {
|
|
35
|
+
size: "small",
|
|
36
|
+
theme: "borderless",
|
|
37
|
+
icon: /*#__PURE__*/React.createElement(IconClose, null),
|
|
38
|
+
onClick: handleClose
|
|
39
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: styles.content,
|
|
41
|
+
ref: contentRef
|
|
42
|
+
}, render === null || render === void 0 ? void 0 : render(), children));
|
|
43
|
+
};
|
|
44
|
+
if (isOverFlow) {
|
|
45
|
+
var targetElm = sidebarTargetElm || document.getElementById('myun_gimi_design_chat');
|
|
46
|
+
if (!targetElm) return null;
|
|
47
|
+
return /*#__PURE__*/ReactDOM.createPortal(renderContent(), targetElm);
|
|
48
|
+
}
|
|
49
|
+
return renderContent();
|
|
40
50
|
});
|
|
41
51
|
export default GimiSideBar;
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default as GimiChatComponent } from "./templates/GimiChatComponent";
|
|
1
|
+
export { default as GimiChatComponent } from "./templates/GimiChatComponent";
|
|
2
|
+
export { default as ShadowLoading } from "./shadow-loading";
|
|
@@ -15,7 +15,6 @@ import ClassList from "./classList";
|
|
|
15
15
|
import { getKnowledgeTraceListFromConent } from "../../utils/tools";
|
|
16
16
|
import useKnowledgeService from "../../hooks/useKnowledgeService";
|
|
17
17
|
import AiLoading from "../ai-loading";
|
|
18
|
-
import ReactDOM from 'react-dom';
|
|
19
18
|
import GimiSideBar from "../gimi-sidebar";
|
|
20
19
|
var KonwledgeTrace = function KonwledgeTrace(_ref) {
|
|
21
20
|
var sidebarTargetElm = _ref.sidebarTargetElm,
|
|
@@ -131,35 +130,29 @@ var KonwledgeTrace = function KonwledgeTrace(_ref) {
|
|
|
131
130
|
return null;
|
|
132
131
|
}
|
|
133
132
|
}, [activeKey, videoSliceList, productList, documentList, isLoading]);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
if (isOverFlow && (kowledgeTraceList === null || kowledgeTraceList === void 0 ? void 0 : kowledgeTraceList.length) > 0) {
|
|
159
|
-
var targetElm = sidebarTargetElm || document.getElementById('myun_gimi_design_chat');
|
|
160
|
-
if (!targetElm) return null;
|
|
161
|
-
return /*#__PURE__*/ReactDOM.createPortal(renderContent(), targetElm);
|
|
162
|
-
}
|
|
163
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, (kowledgeTraceList === null || kowledgeTraceList === void 0 ? void 0 : kowledgeTraceList.length) > 0 ? renderContent() : null);
|
|
133
|
+
if (!(kowledgeTraceList !== null && kowledgeTraceList !== void 0 && kowledgeTraceList.length)) return null;
|
|
134
|
+
return /*#__PURE__*/React.createElement(GimiSideBar, {
|
|
135
|
+
show: showKonwledgeTrace,
|
|
136
|
+
isOverFlow: isOverFlow,
|
|
137
|
+
ref: tabPaneRef,
|
|
138
|
+
title: "\u5F15\u7528\u6765\u6E90",
|
|
139
|
+
handleClose: handleClose,
|
|
140
|
+
style: style,
|
|
141
|
+
className: className,
|
|
142
|
+
sidebarTargetElm: sidebarTargetElm
|
|
143
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
144
|
+
className: styles.tabs
|
|
145
|
+
}, (tabList === null || tabList === void 0 ? void 0 : tabList.length) > 1 ? /*#__PURE__*/React.createElement(Tabs, {
|
|
146
|
+
type: "button",
|
|
147
|
+
size: "small",
|
|
148
|
+
activeKey: activeKey,
|
|
149
|
+
onChange: handleTabChange
|
|
150
|
+
}, tabList.map(function (tab) {
|
|
151
|
+
return /*#__PURE__*/React.createElement(TabPane, {
|
|
152
|
+
tab: tab.name,
|
|
153
|
+
itemKey: tab.type,
|
|
154
|
+
key: tab.type
|
|
155
|
+
}, tabContent);
|
|
156
|
+
})) : tabContent));
|
|
164
157
|
};
|
|
165
158
|
export default KonwledgeTrace;
|
|
@@ -18,7 +18,7 @@ var VideoItem = function VideoItem(_ref) {
|
|
|
18
18
|
return item.id;
|
|
19
19
|
})) === null || _konwledgeTraceState$ === void 0 ? void 0 : _konwledgeTraceState$.includes("".concat(item.sliceId));
|
|
20
20
|
var _useAppSelector = useAppSelector(function (state) {
|
|
21
|
-
return state.gimiMenu.
|
|
21
|
+
return state.gimiMenu.businessParams;
|
|
22
22
|
}),
|
|
23
23
|
gradeId = _useAppSelector.gradeId,
|
|
24
24
|
teachModuleId = _useAppSelector.teachModuleId;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
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
|
+
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
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); }
|
|
8
|
+
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; }
|
|
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; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import { knowledgeConstants } from "../../constants";
|
|
13
|
+
import { Toast } from '@douyinfe/semi-ui';
|
|
14
|
+
import styles from "./index.module.css";
|
|
15
|
+
import { useAppSelector } from "../../store/hooks";
|
|
16
|
+
import { useContext } from 'react';
|
|
17
|
+
import ChatContext from "../templates/chatContext";
|
|
18
|
+
import ShadowLoading from "../shadow-loading";
|
|
19
|
+
var ProductTag = function ProductTag(_ref) {
|
|
20
|
+
var value = _ref.value;
|
|
21
|
+
var platform = useAppSelector(function (state) {
|
|
22
|
+
return state.gimiMenu.platform;
|
|
23
|
+
});
|
|
24
|
+
var _useContext = useContext(ChatContext),
|
|
25
|
+
apiService = _useContext.apiService;
|
|
26
|
+
var _ref2 = apiService,
|
|
27
|
+
checkProductType = _ref2.checkProductType;
|
|
28
|
+
var _useState = useState(false),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
checking = _useState2[0],
|
|
31
|
+
setChecking = _useState2[1];
|
|
32
|
+
var handleIconClick = /*#__PURE__*/function () {
|
|
33
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
34
|
+
var courseId, productType, res, _res$result;
|
|
35
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
36
|
+
while (1) switch (_context.prev = _context.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
if (!(platform !== 'myun')) {
|
|
39
|
+
_context.next = 2;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
return _context.abrupt("return", Toast.error('当前平台暂不支持跳转查看课程'));
|
|
43
|
+
case 2:
|
|
44
|
+
courseId = Number(value);
|
|
45
|
+
if (!isNaN(courseId)) {
|
|
46
|
+
_context.next = 5;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
return _context.abrupt("return", Toast.error('暂无有效的课程查看'));
|
|
50
|
+
case 5:
|
|
51
|
+
productType = 'single'; // 检查课程类型
|
|
52
|
+
_context.prev = 6;
|
|
53
|
+
setChecking(true);
|
|
54
|
+
_context.next = 10;
|
|
55
|
+
return checkProductType(Number(value));
|
|
56
|
+
case 10:
|
|
57
|
+
res = _context.sent;
|
|
58
|
+
if (!(res.status === 0 && res.result)) {
|
|
59
|
+
_context.next = 15;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
productType = (_res$result = res.result) === null || _res$result === void 0 ? void 0 : _res$result.productType;
|
|
63
|
+
_context.next = 16;
|
|
64
|
+
break;
|
|
65
|
+
case 15:
|
|
66
|
+
return _context.abrupt("return", Toast.error(res.message || '暂无有效的课程查看'));
|
|
67
|
+
case 16:
|
|
68
|
+
_context.next = 21;
|
|
69
|
+
break;
|
|
70
|
+
case 18:
|
|
71
|
+
_context.prev = 18;
|
|
72
|
+
_context.t0 = _context["catch"](6);
|
|
73
|
+
return _context.abrupt("return", Toast.error('暂无有效的课程查看'));
|
|
74
|
+
case 21:
|
|
75
|
+
_context.prev = 21;
|
|
76
|
+
setChecking(false);
|
|
77
|
+
return _context.finish(21);
|
|
78
|
+
case 24:
|
|
79
|
+
if (productType === 'single') {
|
|
80
|
+
window.open("/new-product/".concat(courseId));
|
|
81
|
+
} else {
|
|
82
|
+
window.open("/project-product/".concat(courseId));
|
|
83
|
+
}
|
|
84
|
+
case 25:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee, null, [[6, 18, 21, 24]]);
|
|
89
|
+
}));
|
|
90
|
+
return function handleIconClick() {
|
|
91
|
+
return _ref3.apply(this, arguments);
|
|
92
|
+
};
|
|
93
|
+
}();
|
|
94
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
style: {
|
|
96
|
+
display: 'inline-block'
|
|
97
|
+
}
|
|
98
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: styles.icon_btn,
|
|
100
|
+
onClick: handleIconClick
|
|
101
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
102
|
+
style: {
|
|
103
|
+
width: '12px',
|
|
104
|
+
height: '12px'
|
|
105
|
+
},
|
|
106
|
+
alt: "\u67E5\u770B\u8BFE\u7A0B",
|
|
107
|
+
src: knowledgeConstants.CLASS_ICON_ADDRESS
|
|
108
|
+
}), /*#__PURE__*/React.createElement("span", null, "\u67E5\u770B\u8BFE\u7A0B"), /*#__PURE__*/React.createElement(ShadowLoading, {
|
|
109
|
+
loading: checking,
|
|
110
|
+
text: "\u8BF7\u7A0D\u7B49..."
|
|
111
|
+
})));
|
|
112
|
+
};
|
|
113
|
+
export default ProductTag;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.icon_btn {
|
|
2
|
+
width: fit-content;
|
|
3
|
+
height: 22px;
|
|
4
|
+
font-size: 12px;
|
|
5
|
+
padding: 0px 5px;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
gap: 5px;
|
|
11
|
+
border: 0;
|
|
12
|
+
background-color: #f1f7ff;
|
|
13
|
+
}
|
|
14
|
+
.icon_btn:hover {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
background-color: #FFFFFF;
|
|
17
|
+
color: #4086FF;
|
|
18
|
+
}
|
|
@@ -62,8 +62,8 @@ var QuotedContent = function QuotedContent(_ref) {
|
|
|
62
62
|
var gimiMenu = useAppSelector(function (state) {
|
|
63
63
|
return state.gimiMenu;
|
|
64
64
|
});
|
|
65
|
-
var
|
|
66
|
-
var _ref2 =
|
|
65
|
+
var businessParams = gimiMenu.businessParams;
|
|
66
|
+
var _ref2 = businessParams || {},
|
|
67
67
|
productId = _ref2.productId;
|
|
68
68
|
var dispatch = useAppDispatch();
|
|
69
69
|
var _useState7 = useState(false),
|