@myun/gimi-chat 0.0.7 → 0.0.9
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 +2 -0
- package/dist/apis/useApi.js +50 -2
- package/dist/components/ai-chat-dialogue/index.js +135 -181
- package/dist/components/ai-correction/index.js +25 -38
- package/dist/components/ai-loading/index.js +8 -12
- package/dist/components/answer-item/index.d.ts +3 -0
- package/dist/components/answer-item/index.js +126 -135
- package/dist/components/ask-card/index.js +33 -42
- package/dist/components/chat-input/extension/index.d.ts +2 -0
- package/dist/components/chat-input/extension/index.js +2 -0
- package/dist/components/chat-input/extension/keydown/index.d.ts +3 -0
- package/dist/components/chat-input/extension/keydown/index.js +37 -0
- package/dist/components/chat-input/extension/title-slot/Component.d.ts +4 -0
- package/dist/components/chat-input/extension/title-slot/Component.js +18 -0
- package/dist/components/chat-input/extension/title-slot/index.d.ts +3 -0
- package/dist/components/chat-input/extension/title-slot/index.js +47 -0
- package/dist/components/chat-input/extension/title-slot/index.less +22 -0
- package/dist/components/chat-input/index.d.ts +4 -0
- package/dist/components/chat-input/index.js +144 -145
- package/dist/components/chat-input/index.module.css +7 -0
- package/dist/components/chat-voice/VoiceCommunication.js +21 -23
- package/dist/components/chat-voice/VoiceRecord.js +21 -24
- package/dist/components/conversation-delete/index.js +8 -10
- package/dist/components/dots-loading/index.js +7 -10
- package/dist/components/empty/index.js +7 -12
- package/dist/components/excel-components/ExcelCard.js +3 -7
- package/dist/components/excel-components/ExcelExcuting.js +43 -60
- package/dist/components/excel-components/ExcelFailCard.js +10 -15
- package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -1
- package/dist/components/excel-components/ExcelSuccessCard.js +13 -6
- package/dist/components/file-card/fileCardSidebar.js +17 -23
- package/dist/components/file-card/index.d.ts +3 -0
- package/dist/components/file-card/index.js +59 -69
- package/dist/components/file-card/index.module.css +1 -1
- package/dist/components/file-preview/index.js +62 -37
- package/dist/components/file-preview/index.module.css +33 -0
- package/dist/components/file-upload/index.js +7 -10
- package/dist/components/file-upload/uploadV1.js +27 -33
- package/dist/components/gimi-sidebar/index.js +13 -20
- package/dist/components/header/index.js +11 -18
- package/dist/components/iconfont-com/index.js +33 -12
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +22 -28
- package/dist/components/knowledge-trace/classList.js +28 -37
- package/dist/components/knowledge-trace/documentList.js +27 -36
- package/dist/components/knowledge-trace/index.js +21 -28
- package/dist/components/knowledge-trace/videoList.js +36 -46
- package/dist/components/lottie-img/index.js +8 -10
- package/dist/components/message-actions/CopyButton.d.ts +1 -1
- package/dist/components/message-actions/CopyButton.js +22 -25
- package/dist/components/message-actions/LikeButton.js +22 -25
- package/dist/components/message-actions/RegenerateButton.js +18 -21
- package/dist/components/message-actions/UnLikeButton.js +22 -25
- package/dist/components/message-actions/VoicePlay.js +22 -25
- package/dist/components/message-list/index.js +83 -87
- package/dist/components/no-microphone-root/index.js +29 -39
- package/dist/components/preset-agent-content/index.d.ts +1 -0
- package/dist/components/preset-agent-content/index.js +27 -20
- package/dist/components/quoted-content/index.d.ts +3 -0
- package/dist/components/quoted-content/index.js +271 -163
- package/dist/components/quoted-content/index.module.css +20 -0
- package/dist/components/reasoning-content/index.d.ts +3 -2
- package/dist/components/reasoning-content/index.js +50 -61
- package/dist/components/reference-content/index.js +62 -71
- package/dist/components/reference-content/index.module.css +1 -0
- package/dist/components/search-result/index.d.ts +7 -0
- package/dist/components/search-result/index.js +182 -0
- package/dist/components/search-result/index.module.css +235 -0
- package/dist/components/templates/CommonChat.js +75 -79
- package/dist/components/templates/GimiChatComponent.js +6 -13
- package/dist/components/templates/demo/demo.js +109 -103
- package/dist/components/upload-list/index.js +41 -56
- package/dist/components/voice-bars/index.js +19 -22
- package/dist/components/voice-check-dialog/index.js +17 -24
- package/dist/components/voice-recording/index.js +42 -57
- package/dist/components/work-flow-content/demo.js +1 -2
- package/dist/components/work-flow-content/index.js +8 -11
- package/dist/hooks/useChatActions.d.ts +1 -1
- package/dist/hooks/useChatActions.js +3 -1
- package/dist/hooks/useCommonChatAPI.d.ts +2 -1
- package/dist/hooks/useCommonChatAPI.js +10 -8
- package/dist/hooks/useQuoted.d.ts +12 -0
- package/dist/hooks/useQuoted.js +202 -0
- package/dist/utils/aes.d.ts +21 -0
- package/dist/utils/aes.js +61 -0
- package/dist/utils/chatInputUtil.d.ts +1 -1
- package/dist/utils/chatInputUtil.js +4 -3
- package/package.json +6 -2
|
@@ -2,45 +2,35 @@ import React from 'react';
|
|
|
2
2
|
import { Button } from '@douyinfe/semi-ui';
|
|
3
3
|
import styles from "./index.module.css";
|
|
4
4
|
import { IconClose, IconMicrophoneOffStroked } from '@douyinfe/semi-icons';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
5
|
export default function NoMicrophoneModalContent(_ref) {
|
|
8
6
|
var onOk = _ref.onOk;
|
|
9
|
-
return /*#__PURE__*/
|
|
10
|
-
className: styles.root
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
borderRadius: '24px',
|
|
39
|
-
padding: '10px'
|
|
40
|
-
},
|
|
41
|
-
onClick: onOk,
|
|
42
|
-
children: "\u6211\u77E5\u9053\u4E86"
|
|
43
|
-
})
|
|
44
|
-
})]
|
|
45
|
-
});
|
|
7
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
8
|
+
className: styles.root
|
|
9
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
10
|
+
className: styles.title
|
|
11
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u5C1A\u672A\u83B7\u5F97\u9EA6\u514B\u98CE\u6743\u9650"), /*#__PURE__*/React.createElement(Button, {
|
|
12
|
+
theme: "borderless",
|
|
13
|
+
size: "small",
|
|
14
|
+
icon: /*#__PURE__*/React.createElement(IconClose, null),
|
|
15
|
+
onClick: onOk
|
|
16
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
className: styles.desc
|
|
18
|
+
}, "\u8BED\u97F3\u901A\u8BDD\u9700\u8981\u5F00\u542F\u6D4F\u89C8\u5668\u7684\u9EA6\u514B\u98CE\u6743\u9650\uFF0C\u8BF7\u70B9\u51FB\u524D\u5F80\u8BBE\u7F6E\u8FDB\u884C\u5F00\u542F"), /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: styles.imgArea
|
|
20
|
+
}, /*#__PURE__*/React.createElement(IconMicrophoneOffStroked, {
|
|
21
|
+
style: {
|
|
22
|
+
fontSize: 40,
|
|
23
|
+
color: '#1478ddff'
|
|
24
|
+
}
|
|
25
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: styles.footer
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
28
|
+
type: "primary",
|
|
29
|
+
size: "small",
|
|
30
|
+
style: {
|
|
31
|
+
borderRadius: '24px',
|
|
32
|
+
padding: '10px'
|
|
33
|
+
},
|
|
34
|
+
onClick: onOk
|
|
35
|
+
}, "\u6211\u77E5\u9053\u4E86")));
|
|
46
36
|
}
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styles from "./index.module.css";
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
3
|
var PresetAgentContent = function PresetAgentContent(_ref) {
|
|
6
4
|
var prologue = _ref.prologue,
|
|
7
5
|
questionList = _ref.questionList,
|
|
8
|
-
setInputValue = _ref.setInputValue
|
|
6
|
+
setInputValue = _ref.setInputValue,
|
|
7
|
+
layout = _ref.layout;
|
|
9
8
|
if (!questionList || questionList.length === 0) return null;
|
|
10
|
-
|
|
9
|
+
var rowListStyle = {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
flexWrap: 'wrap',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
flex: 1
|
|
15
|
+
};
|
|
16
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
17
|
className: styles.container,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
style: {
|
|
19
|
+
flexDirection: layout === 'vertical' ? 'column' : 'row'
|
|
20
|
+
}
|
|
21
|
+
}, prologue && /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: styles.prologue
|
|
23
|
+
}, prologue), /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: styles.quickInputList,
|
|
25
|
+
style: layout === 'vertical' ? {} : rowListStyle
|
|
26
|
+
}, questionList.map(function (item, index) {
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: styles.quickInputItem,
|
|
29
|
+
key: index,
|
|
30
|
+
onClick: function onClick() {
|
|
31
|
+
return setInputValue(item.question);
|
|
32
|
+
}
|
|
33
|
+
}, item.question);
|
|
34
|
+
})));
|
|
28
35
|
};
|
|
29
36
|
export default PresetAgentContent;
|
|
@@ -1,171 +1,279 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
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."); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import { Input, Toast, Table, Popover, Space } from '@douyinfe/semi-ui';
|
|
18
|
+
import styles from "./index.module.css";
|
|
19
|
+
import { useCallback, useRef, useState } from 'react';
|
|
20
|
+
import IconFontCom from "../iconfont-com";
|
|
21
|
+
import { knowledgeConstants } from "../../constants";
|
|
22
|
+
import useQuotedService from "../../hooks/useQuoted";
|
|
23
|
+
import { useAppSelector, useAppDispatch } from "../../store/hooks";
|
|
24
|
+
import { setQuoteProductList, setQuoteTeachModelList } from "../../store/slices/gimiMenuSlice";
|
|
25
|
+
import { throttle } from 'lodash';
|
|
26
|
+
import React from 'react';
|
|
27
|
+
var DEBOUNCE_MS = 600; // 拉长到 600 ms
|
|
10
28
|
|
|
11
|
-
|
|
29
|
+
var tabList = [{
|
|
30
|
+
key: 'video',
|
|
31
|
+
displayName: '视频'
|
|
32
|
+
}
|
|
33
|
+
// { key: 'course', displayName: '课程' },
|
|
34
|
+
];
|
|
35
|
+
var quotoIcon = 'https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202511/18/aedd7_20251118092438.png';
|
|
36
|
+
var isActiveQuotoIcon = 'https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202512/01/aa4b5_20251201110652.png';
|
|
37
|
+
var QuotedContent = function QuotedContent() {
|
|
38
|
+
var _useState = useState('video'),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
activeKey = _useState2[0],
|
|
41
|
+
setActiveKey = _useState2[1];
|
|
42
|
+
var _useState3 = useState({
|
|
43
|
+
pageSize: 20,
|
|
44
|
+
pageIndex: 1,
|
|
45
|
+
inputValue: ''
|
|
46
|
+
}),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
searchValue = _useState4[0],
|
|
49
|
+
setSearchValue = _useState4[1];
|
|
50
|
+
var _useState5 = useState(''),
|
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
+
inputValue = _useState6[0],
|
|
53
|
+
setInputValue = _useState6[1];
|
|
54
|
+
var timeoutRef = useRef(null);
|
|
55
|
+
var composingRef = useRef(false); // 标记是否正在拼写中文
|
|
56
|
+
var tabContentRef = useRef(null);
|
|
57
|
+
var gimiMenu = useAppSelector(function (state) {
|
|
58
|
+
return state.gimiMenu;
|
|
59
|
+
});
|
|
60
|
+
var dispatch = useAppDispatch();
|
|
61
|
+
var _useState7 = useState(false),
|
|
62
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
63
|
+
showmodel = _useState8[0],
|
|
64
|
+
setShowmodel = _useState8[1];
|
|
65
|
+
var _useQuotedService = useQuotedService({
|
|
66
|
+
type: activeKey,
|
|
67
|
+
searchValue: searchValue,
|
|
68
|
+
showmodel: showmodel
|
|
69
|
+
}),
|
|
70
|
+
resource = _useQuotedService.resource,
|
|
71
|
+
isLoading = _useQuotedService.isLoading,
|
|
72
|
+
totalPage = _useQuotedService.totalPage;
|
|
73
|
+
var columns = [{
|
|
74
|
+
title: '名称',
|
|
75
|
+
dataIndex: 'name',
|
|
76
|
+
key: 'name',
|
|
77
|
+
render: function render(text) {
|
|
78
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
79
|
+
className: styles.listItem
|
|
80
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
81
|
+
alt: "\u8D44\u6599\u5F15\u7528\u56FE\u7247",
|
|
82
|
+
className: styles.img,
|
|
83
|
+
src: activeKey === 'video' ? knowledgeConstants.VIDEO_ICON_ADDRESS : knowledgeConstants.CLASS_ICON_BIG_ADDRESS
|
|
84
|
+
}), text);
|
|
85
|
+
}
|
|
86
|
+
}];
|
|
87
|
+
var handleClose = useCallback(function () {
|
|
88
|
+
setShowmodel(false);
|
|
89
|
+
setInputValue('');
|
|
90
|
+
setSearchValue({
|
|
91
|
+
pageSize: 20,
|
|
92
|
+
pageIndex: 1,
|
|
93
|
+
inputValue: ''
|
|
94
|
+
});
|
|
95
|
+
}, []);
|
|
96
|
+
var handleTabChange = function handleTabChange(key) {
|
|
97
|
+
if (activeKey === key) return;
|
|
98
|
+
setActiveKey(key);
|
|
99
|
+
setSearchValue({
|
|
100
|
+
pageSize: 20,
|
|
101
|
+
pageIndex: 1,
|
|
102
|
+
inputValue: inputValue
|
|
103
|
+
});
|
|
104
|
+
//滚动条置顶
|
|
105
|
+
if (tabContentRef.current) {
|
|
106
|
+
tabContentRef.current.scrollTop = 0;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
12
109
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
110
|
+
// 触发搜索的函数
|
|
111
|
+
var doSearch = function doSearch(val) {
|
|
112
|
+
setSearchValue({
|
|
113
|
+
pageSize: 20,
|
|
114
|
+
pageIndex: 1,
|
|
115
|
+
inputValue: val
|
|
116
|
+
});
|
|
117
|
+
};
|
|
17
118
|
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
119
|
+
// 中文输入开始
|
|
120
|
+
var handleCompositionStart = function handleCompositionStart() {
|
|
121
|
+
composingRef.current = true;
|
|
122
|
+
};
|
|
21
123
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
124
|
+
// 中文输入结束
|
|
125
|
+
var handleCompositionEnd = function handleCompositionEnd(e) {
|
|
126
|
+
composingRef.current = false;
|
|
127
|
+
var val = e.currentTarget.value;
|
|
128
|
+
setInputValue(val);
|
|
129
|
+
// 拼完中文再“延迟”一次,避免和下面的 debounce 冲突
|
|
130
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
131
|
+
timeoutRef.current = setTimeout(function () {
|
|
132
|
+
return doSearch(val);
|
|
133
|
+
}, DEBOUNCE_MS);
|
|
134
|
+
};
|
|
33
135
|
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// {text}
|
|
44
|
-
// </span>
|
|
45
|
-
// );
|
|
46
|
-
// },
|
|
47
|
-
// },
|
|
48
|
-
// ];
|
|
136
|
+
// 普通输入
|
|
137
|
+
var handleChange = function handleChange(value) {
|
|
138
|
+
setInputValue(value);
|
|
139
|
+
if (composingRef.current) return; // 中文拼写过程中不处理
|
|
140
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
141
|
+
timeoutRef.current = setTimeout(function () {
|
|
142
|
+
return doSearch(value);
|
|
143
|
+
}, DEBOUNCE_MS);
|
|
144
|
+
};
|
|
49
145
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
146
|
+
//抽出共同逻辑
|
|
147
|
+
var addIfAbsent = function addIfAbsent(list, key, newItem) {
|
|
148
|
+
if (list.some(function (it) {
|
|
149
|
+
return it[key] === newItem[key];
|
|
150
|
+
})) return;
|
|
151
|
+
if (key === 'teachModelId') {
|
|
152
|
+
dispatch(setQuoteTeachModelList({
|
|
153
|
+
quoteTeachModelList: [].concat(_toConsumableArray(list), [newItem])
|
|
154
|
+
}));
|
|
155
|
+
} else {
|
|
156
|
+
dispatch(setQuoteProductList({
|
|
157
|
+
quoteProductList: [].concat(_toConsumableArray(list), [newItem])
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
};
|
|
57
161
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
162
|
+
//选择资源
|
|
163
|
+
var handleSelect = function handleSelect(record) {
|
|
164
|
+
//总条数需小于等于十
|
|
165
|
+
if (gimiMenu.quoteTeachModelList.length + gimiMenu.quoteProductList.length >= 10) {
|
|
166
|
+
Toast.warning('最多添加10个资源');
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (activeKey === 'video') {
|
|
170
|
+
addIfAbsent(gimiMenu.quoteTeachModelList, 'teachModelId', {
|
|
171
|
+
teachModelId: record.id,
|
|
172
|
+
teachModelName: record.name,
|
|
173
|
+
duration: record.duration
|
|
174
|
+
});
|
|
175
|
+
} else {
|
|
176
|
+
addIfAbsent(gimiMenu.quoteProductList, 'productId', {
|
|
177
|
+
productId: record.productId,
|
|
178
|
+
productName: record.productName
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
handleClose();
|
|
182
|
+
};
|
|
62
183
|
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
159
|
-
// pagination={false}
|
|
160
|
-
// className={styles.table}
|
|
161
|
-
// key="id"
|
|
162
|
-
// loading={isLoading}
|
|
163
|
-
// onRow={(record: any) => {
|
|
164
|
-
// return { onClick: () => handleSelect(record) };
|
|
165
|
-
// }}
|
|
166
|
-
// />
|
|
167
|
-
// </div>
|
|
168
|
-
// </div>
|
|
169
|
-
// </div>
|
|
170
|
-
// );
|
|
171
|
-
// };
|
|
184
|
+
// 滚动加载更多
|
|
185
|
+
var throttledScroll = useCallback(throttle(function (scrollTop, scrollHeight, clientHeight) {
|
|
186
|
+
// 距离底部小于 10px 时触发加载
|
|
187
|
+
var isNearBottom = scrollHeight - scrollTop - clientHeight < 10;
|
|
188
|
+
if (searchValue.pageIndex < totalPage && isNearBottom && !isLoading) {
|
|
189
|
+
setSearchValue(function (prev) {
|
|
190
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
191
|
+
pageIndex: (prev.pageIndex || 0) + 1
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}, 200), [searchValue.pageIndex, totalPage, isLoading]);
|
|
196
|
+
var handleScroll = function handleScroll(e) {
|
|
197
|
+
var _e$currentTarget = e.currentTarget,
|
|
198
|
+
scrollTop = _e$currentTarget.scrollTop,
|
|
199
|
+
scrollHeight = _e$currentTarget.scrollHeight,
|
|
200
|
+
clientHeight = _e$currentTarget.clientHeight;
|
|
201
|
+
throttledScroll(scrollTop, scrollHeight, clientHeight);
|
|
202
|
+
};
|
|
203
|
+
var renderContent = function renderContent() {
|
|
204
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
205
|
+
style: {
|
|
206
|
+
padding: 12,
|
|
207
|
+
width: 300
|
|
208
|
+
}
|
|
209
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
210
|
+
style: {
|
|
211
|
+
width: '100%',
|
|
212
|
+
height: '100%'
|
|
213
|
+
}
|
|
214
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
className: styles.quotedContent
|
|
216
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
217
|
+
value: inputValue,
|
|
218
|
+
showClear: true,
|
|
219
|
+
className: styles.searchInput,
|
|
220
|
+
prefix: /*#__PURE__*/React.createElement(IconFontCom, {
|
|
221
|
+
type: "icon-search1",
|
|
222
|
+
color: "#7D91B3",
|
|
223
|
+
size: 16
|
|
224
|
+
}),
|
|
225
|
+
onChange: handleChange,
|
|
226
|
+
onCompositionStart: handleCompositionStart,
|
|
227
|
+
onCompositionEnd: handleCompositionEnd,
|
|
228
|
+
placeholder: "\u641C\u7D22"
|
|
229
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
230
|
+
className: styles.content
|
|
231
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
232
|
+
className: styles.newtab
|
|
233
|
+
}, tabList.map(function (tab) {
|
|
234
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
235
|
+
className: "".concat(styles.tabItem, " ").concat(tab.key === activeKey ? styles.active : ''),
|
|
236
|
+
key: tab.key,
|
|
237
|
+
onClick: function onClick() {
|
|
238
|
+
return handleTabChange(tab.key);
|
|
239
|
+
}
|
|
240
|
+
}, tab.displayName);
|
|
241
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
242
|
+
className: styles.tabContent,
|
|
243
|
+
ref: tabContentRef,
|
|
244
|
+
onScroll: handleScroll
|
|
245
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
246
|
+
dataSource: resource,
|
|
247
|
+
showHeader: false,
|
|
248
|
+
size: "small",
|
|
249
|
+
columns: columns,
|
|
250
|
+
pagination: false,
|
|
251
|
+
className: styles.table,
|
|
252
|
+
key: "id",
|
|
253
|
+
loading: isLoading,
|
|
254
|
+
onRow: function onRow(record) {
|
|
255
|
+
return {
|
|
256
|
+
onClick: function onClick() {
|
|
257
|
+
return handleSelect(record);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
}))))));
|
|
262
|
+
};
|
|
263
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
264
|
+
visible: showmodel,
|
|
265
|
+
content: renderContent,
|
|
266
|
+
trigger: "custom",
|
|
267
|
+
stopPropagation: true,
|
|
268
|
+
onClickOutSide: handleClose
|
|
269
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
270
|
+
className: "".concat(styles.quotationIcon, " ").concat(showmodel && styles.isActive),
|
|
271
|
+
onClick: function onClick() {
|
|
272
|
+
return setShowmodel(true);
|
|
273
|
+
}
|
|
274
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
275
|
+
src: showmodel ? isActiveQuotoIcon : quotoIcon,
|
|
276
|
+
alt: ""
|
|
277
|
+
})));
|
|
278
|
+
};
|
|
279
|
+
export default QuotedContent;
|
|
@@ -77,4 +77,24 @@
|
|
|
77
77
|
|
|
78
78
|
.tabContent::-webkit-scrollbar-thumb:hover {
|
|
79
79
|
background: #a8a8a8;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.quotationIcon {
|
|
83
|
+
width: 32px;
|
|
84
|
+
height: 32px;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
}
|
|
87
|
+
.quotationIcon:hover {
|
|
88
|
+
background-color: #f2f3f7;
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
}
|
|
91
|
+
.quotationIcon img {
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
object-fit: cover;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.isActive {
|
|
98
|
+
background-color: #f2f3f7;
|
|
99
|
+
border-radius: 8px;
|
|
80
100
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IChatMessageItem } from '../../interfaces/chatMessage';
|
|
3
|
-
declare const
|
|
3
|
+
declare const ReasoningContent: React.FC<{
|
|
4
|
+
reasoningTitle?: string;
|
|
4
5
|
item: IChatMessageItem;
|
|
5
6
|
}>;
|
|
6
|
-
export default
|
|
7
|
+
export default ReasoningContent;
|