@myun/gimi-chat 0.0.8 → 0.1.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.
Files changed (101) hide show
  1. package/dist/apis/useApi.d.ts +2 -0
  2. package/dist/apis/useApi.js +50 -2
  3. package/dist/components/ai-chat-dialogue/index.js +135 -181
  4. package/dist/components/ai-correction/index.js +25 -38
  5. package/dist/components/ai-loading/index.js +8 -12
  6. package/dist/components/answer-item/index.d.ts +3 -0
  7. package/dist/components/answer-item/index.js +126 -135
  8. package/dist/components/ask-card/index.js +33 -42
  9. package/dist/components/chat-input/extension/index.d.ts +2 -0
  10. package/dist/components/chat-input/extension/index.js +2 -0
  11. package/dist/components/chat-input/extension/keydown/index.d.ts +3 -0
  12. package/dist/components/chat-input/extension/keydown/index.js +37 -0
  13. package/dist/components/chat-input/extension/title-slot/Component.d.ts +4 -0
  14. package/dist/components/chat-input/extension/title-slot/Component.js +18 -0
  15. package/dist/components/chat-input/extension/title-slot/index.d.ts +3 -0
  16. package/dist/components/chat-input/extension/title-slot/index.js +47 -0
  17. package/dist/components/chat-input/extension/title-slot/index.less +22 -0
  18. package/dist/components/chat-input/index.d.ts +4 -0
  19. package/dist/components/chat-input/index.js +144 -145
  20. package/dist/components/chat-input/index.module.css +7 -0
  21. package/dist/components/chat-voice/VoiceCommunication.js +21 -23
  22. package/dist/components/chat-voice/VoiceRecord.js +21 -24
  23. package/dist/components/conversation-delete/index.js +8 -10
  24. package/dist/components/dots-loading/index.js +7 -10
  25. package/dist/components/empty/index.js +7 -12
  26. package/dist/components/excel-components/ExcelCard.js +3 -7
  27. package/dist/components/excel-components/ExcelExcuting.js +43 -60
  28. package/dist/components/excel-components/ExcelFailCard.js +10 -15
  29. package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -1
  30. package/dist/components/excel-components/ExcelSuccessCard.js +13 -6
  31. package/dist/components/file-card/fileCardSidebar.js +17 -23
  32. package/dist/components/file-card/index.d.ts +3 -0
  33. package/dist/components/file-card/index.js +59 -69
  34. package/dist/components/file-card/index.module.css +1 -1
  35. package/dist/components/file-preview/index.js +62 -37
  36. package/dist/components/file-preview/index.module.css +33 -0
  37. package/dist/components/file-upload/index.js +7 -10
  38. package/dist/components/file-upload/uploadV1.js +27 -33
  39. package/dist/components/gimi-sidebar/index.js +13 -20
  40. package/dist/components/header/index.js +11 -18
  41. package/dist/components/iconfont-com/index.js +33 -12
  42. package/dist/components/index.d.ts +1 -1
  43. package/dist/components/index.js +1 -1
  44. package/dist/components/knowledge-trace/KnowledgeIconComponent.js +22 -28
  45. package/dist/components/knowledge-trace/classList.js +28 -37
  46. package/dist/components/knowledge-trace/documentList.js +27 -36
  47. package/dist/components/knowledge-trace/index.js +21 -28
  48. package/dist/components/knowledge-trace/videoList.js +36 -46
  49. package/dist/components/lottie-img/index.js +8 -10
  50. package/dist/components/message-actions/CopyButton.d.ts +1 -1
  51. package/dist/components/message-actions/CopyButton.js +22 -25
  52. package/dist/components/message-actions/LikeButton.js +22 -25
  53. package/dist/components/message-actions/RegenerateButton.js +18 -21
  54. package/dist/components/message-actions/UnLikeButton.js +22 -25
  55. package/dist/components/message-actions/VoicePlay.js +22 -25
  56. package/dist/components/message-list/index.js +83 -87
  57. package/dist/components/no-microphone-root/index.js +29 -39
  58. package/dist/components/preset-agent-content/index.d.ts +1 -0
  59. package/dist/components/preset-agent-content/index.js +27 -20
  60. package/dist/components/quoted-content/index.d.ts +3 -0
  61. package/dist/components/quoted-content/index.js +271 -163
  62. package/dist/components/quoted-content/index.module.css +20 -0
  63. package/dist/components/reasoning-content/index.d.ts +3 -2
  64. package/dist/components/reasoning-content/index.js +50 -61
  65. package/dist/components/reference-content/index.js +62 -71
  66. package/dist/components/reference-content/index.module.css +1 -0
  67. package/dist/components/search-result/index.d.ts +7 -0
  68. package/dist/components/search-result/index.js +182 -0
  69. package/dist/components/search-result/index.module.css +235 -0
  70. package/dist/components/templates/CommonChat.js +75 -79
  71. package/dist/components/templates/GimiChatComponent.js +6 -13
  72. package/dist/components/upload-list/index.js +41 -56
  73. package/dist/components/voice-bars/index.js +19 -22
  74. package/dist/components/voice-check-dialog/index.js +17 -24
  75. package/dist/components/voice-recording/index.js +42 -57
  76. package/dist/components/work-flow-content/index.js +8 -11
  77. package/dist/hooks/useChatActions.d.ts +1 -1
  78. package/dist/hooks/useChatActions.js +3 -1
  79. package/dist/hooks/useCommonChatAPI.d.ts +2 -1
  80. package/dist/hooks/useCommonChatAPI.js +10 -8
  81. package/dist/hooks/useQuoted.d.ts +12 -0
  82. package/dist/hooks/useQuoted.js +202 -0
  83. package/dist/index.d.ts +2 -0
  84. package/dist/index.js +3 -1
  85. package/dist/interfaces/index.d.ts +3 -0
  86. package/dist/interfaces/index.js +3 -0
  87. package/dist/types/answer.d.ts +16 -0
  88. package/dist/types/chat.d.ts +124 -0
  89. package/dist/types/file.d.ts +20 -0
  90. package/dist/types/index.d.ts +3 -0
  91. package/dist/types/index.js +3 -0
  92. package/dist/types/modules.d.ts +36 -0
  93. package/dist/utils/aes.d.ts +21 -0
  94. package/dist/utils/aes.js +61 -0
  95. package/dist/utils/chatInputUtil.d.ts +1 -1
  96. package/dist/utils/chatInputUtil.js +4 -3
  97. package/package.json +1 -1
  98. package/dist/components/templates/demo/demo.d.ts +0 -2
  99. package/dist/components/templates/demo/demo.js +0 -111
  100. package/dist/components/work-flow-content/demo.d.ts +0 -3
  101. package/dist/components/work-flow-content/demo.js +0 -12
@@ -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__*/_jsxs("div", {
10
- className: styles.root,
11
- children: [/*#__PURE__*/_jsxs("div", {
12
- className: styles.title,
13
- children: [/*#__PURE__*/_jsx("span", {
14
- children: "\u5C1A\u672A\u83B7\u5F97\u9EA6\u514B\u98CE\u6743\u9650"
15
- }), /*#__PURE__*/_jsx(Button, {
16
- theme: "borderless",
17
- size: "small",
18
- icon: /*#__PURE__*/_jsx(IconClose, {}),
19
- onClick: onOk
20
- })]
21
- }), /*#__PURE__*/_jsx("div", {
22
- className: styles.desc,
23
- children: "\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"
24
- }), /*#__PURE__*/_jsx("div", {
25
- className: styles.imgArea,
26
- children: /*#__PURE__*/_jsx(IconMicrophoneOffStroked, {
27
- style: {
28
- fontSize: 40,
29
- color: '#1478ddff'
30
- }
31
- })
32
- }), /*#__PURE__*/_jsx("div", {
33
- className: styles.footer,
34
- children: /*#__PURE__*/_jsx(Button, {
35
- type: "primary",
36
- size: "small",
37
- style: {
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
  }
@@ -3,6 +3,7 @@ interface IProps {
3
3
  prologue: string;
4
4
  questionList: any[];
5
5
  setInputValue: (value: string) => void;
6
+ layout: 'vertical' | 'horizontal';
6
7
  }
7
8
  declare const PresetAgentContent: React.FC<IProps>;
8
9
  export default PresetAgentContent;
@@ -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
- return /*#__PURE__*/_jsxs("div", {
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
- children: [prologue && /*#__PURE__*/_jsx("div", {
13
- className: styles.prologue,
14
- children: prologue
15
- }), /*#__PURE__*/_jsx("div", {
16
- className: styles.quickInputList,
17
- children: questionList.map(function (item, index) {
18
- return /*#__PURE__*/_jsx("div", {
19
- className: styles.quickInputItem,
20
- onClick: function onClick() {
21
- return setInputValue(item.question);
22
- },
23
- children: item.question
24
- }, index);
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;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const QuotedContent: React.FC;
3
+ export default QuotedContent;
@@ -1,171 +1,279 @@
1
- // import { Input, message, Table } from 'antd';
2
- // import styles from './index.module.scss';
3
- // import { useEffect, useRef, useState } from 'react';
4
- // import IconFontCom from '@/components/iconfont-com';
5
- // import { knowledgeConstants } from '../../constants';
6
- // import useQuotedService from '../../hooks/useQuoted';
7
- // import { useDispatch, useSelector } from 'react-redux';
8
- // import type { RootState } from '@/module';
9
- // import { throttle } from 'lodash';
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
- // const DEBOUNCE_MS = 600; // 拉长到 600 ms
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
- // const tabList: any[] = [
14
- // { key: 'video', displayName: '视频' },
15
- // // { key: 'course', displayName: '课程' },
16
- // ];
110
+ // 触发搜索的函数
111
+ var doSearch = function doSearch(val) {
112
+ setSearchValue({
113
+ pageSize: 20,
114
+ pageIndex: 1,
115
+ inputValue: val
116
+ });
117
+ };
17
118
 
18
- // interface Iprops {
19
- // close: () => void;
20
- // }
119
+ // 中文输入开始
120
+ var handleCompositionStart = function handleCompositionStart() {
121
+ composingRef.current = true;
122
+ };
21
123
 
22
- // export const QuotedContent: React.FC<Iprops> = ({ close }) => {
23
- // const [activeKey, setActiveKey] = useState('video');
24
- // const [searchValue, setSearchValue] = useState({ pageSize: 20, pageIndex: 1, inputValue: '' });
25
- // const [inputValue, setInputValue] = useState('');
26
- // const inputRef = useRef<any>(null);
27
- // const timeoutRef = useRef<NodeJS.Timeout | null>(null);
28
- // const composingRef = useRef(false); // 标记是否正在拼写中文
29
- // const tabContentRef = useRef<HTMLDivElement>(null);
30
- // const gimiMenu = useSelector((state: RootState) => state.gimiMenu);
31
- // const dispatch = useDispatch();
32
- // const { resource, isLoading, totalPage } = useQuotedService({ props: { type: activeKey, searchValue } });
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
- // const columns = [
35
- // {
36
- // title: '名称',
37
- // dataIndex: 'name',
38
- // key: 'name',
39
- // render: (text: string) => {
40
- // return (
41
- // <span className={styles.listItem}>
42
- // <img alt="资料引用图片" className={styles.img} src={activeKey === 'video' ? knowledgeConstants.VIDEO_ICON_ADDRESS : knowledgeConstants.CLASS_ICON_BIG_ADDRESS} />
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
- // const handleTabChange = (key: string) => {
51
- // if (activeKey === key) return;
52
- // setActiveKey(key);
53
- // setSearchValue({ pageSize: 20, pageIndex: 1, inputValue: inputValue });
54
- // //滚动条置顶
55
- // tabContentRef.current.scrollTop = 0;
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
- // const doSearch = (val: string) => {
60
- // setSearchValue({ pageSize: 20, pageIndex: 1, inputValue: val });
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
- // const handleCompositionStart = () => {
65
- // composingRef.current = true;
66
- // };
67
-
68
- // // 中文输入结束
69
- // const handleCompositionEnd = (e: React.CompositionEvent<HTMLInputElement>) => {
70
- // composingRef.current = false;
71
- // const val = e.currentTarget.value;
72
- // setInputValue(val);
73
- // // 拼完中文再“延迟”一次,避免和下面的 debounce 冲突
74
- // if (timeoutRef.current) clearTimeout(timeoutRef.current);
75
- // timeoutRef.current = setTimeout(() => doSearch(val), DEBOUNCE_MS);
76
- // };
77
-
78
- // // 普通输入
79
- // const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
80
- // const val = e.target.value;
81
- // setInputValue(val);
82
- // if (composingRef.current) return; // 中文拼写过程中不处理
83
- // if (timeoutRef.current) clearTimeout(timeoutRef.current);
84
- // timeoutRef.current = setTimeout(() => doSearch(val), DEBOUNCE_MS);
85
- // };
86
-
87
- // //抽出共同逻辑
88
- // const addIfAbsent = (list, key, newItem) => {
89
- // if (list.some((it) => it[key] === newItem[key])) return;
90
- // dispatch({
91
- // type: `gimiMenu/set${key === 'teachModelId' ? 'QuoteTeachModelList' : 'QuoteProductList'}`,
92
- // payload: { [`quote${key === 'teachModelId' ? 'TeachModel' : 'Product'}List`]: [...list, newItem] },
93
- // });
94
- // };
95
-
96
- // //选择资源
97
- // const handleSelect = (record: any) => {
98
- // //总条数需小于等于十
99
- // if (gimiMenu.quoteTeachModelList.length + gimiMenu.quoteProductList.length >= 10) {
100
- // message.warning('最多添加10个资源');
101
- // return;
102
- // }
103
- // if (activeKey === 'video') {
104
- // addIfAbsent(gimiMenu.quoteTeachModelList, 'teachModelId', { teachModelId: record.id, teachModelName: record.name, duration: record.duration });
105
- // } else {
106
- // addIfAbsent(gimiMenu.quoteProductList, 'productId', { productId: record.productId, productName: record.productName });
107
- // }
108
- // close();
109
- // };
110
-
111
- // useEffect(() => {
112
- // const formCard = tabContentRef.current;
113
- // if (!formCard) return;
114
- // //增加throttle
115
- // const handleScroll = throttle(() => {
116
- // const { scrollTop, scrollHeight, clientHeight } = formCard;
117
- // const isNearBottom = scrollHeight - scrollTop - clientHeight < 2;
118
- // if (searchValue.pageIndex < totalPage && isNearBottom) {
119
- // setSearchValue((prev) => ({
120
- // ...prev,
121
- // pageIndex: prev.pageIndex ? prev.pageIndex + 1 : 1,
122
- // }));
123
- // }
124
- // }, 100);
125
- // formCard.addEventListener('scroll', handleScroll);
126
-
127
- // return () => formCard.removeEventListener('scroll', handleScroll);
128
- // }, [totalPage, activeKey, searchValue]);
129
-
130
- // return (
131
- // <div className={styles.quotedContent}>
132
- // <Input
133
- // value={inputValue}
134
- // allowClear
135
- // className={styles.searchInput}
136
- // ref={inputRef}
137
- // prefix={<IconFontCom type="icon-search1" color="#7D91B3" size={16} />}
138
- // onChange={handleChange}
139
- // onCompositionStart={handleCompositionStart}
140
- // onCompositionEnd={handleCompositionEnd}
141
- // placeholder="搜索"
142
- // />
143
- // <div className={styles.content}>
144
- // <div className={styles.newtab}>
145
- // {tabList.map((tab) => {
146
- // return (
147
- // <span className={`${styles.tabItem} ${tab.key === activeKey ? styles.active : ''}`} key={tab.key} onClick={() => handleTabChange(tab.key)}>
148
- // {tab.displayName}
149
- // </span>
150
- // );
151
- // })}
152
- // </div>
153
- // <div className={styles.tabContent} ref={tabContentRef}>
154
- // <Table
155
- // dataSource={resource}
156
- // showHeader={false}
157
- // size="small"
158
- // columns={columns}
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 ResoningContent: React.FC<{
3
+ declare const ReasoningContent: React.FC<{
4
+ reasoningTitle?: string;
4
5
  item: IChatMessageItem;
5
6
  }>;
6
- export default ResoningContent;
7
+ export default ReasoningContent;