@myun/gimi-chat 0.0.3 → 0.0.5

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 (206) hide show
  1. package/dist/apis/fetch.d.ts +64 -0
  2. package/dist/apis/fetch.js +512 -0
  3. package/dist/apis/useApi.d.ts +57 -0
  4. package/dist/apis/useApi.js +378 -0
  5. package/dist/assets/image/Subtract.png +0 -0
  6. package/dist/assets/image/ai-logo.png +0 -0
  7. package/dist/assets/image/copyIcon.png +0 -0
  8. package/dist/assets/image/deepthinkActive.png +0 -0
  9. package/dist/assets/image/empty-img-dark.png +0 -0
  10. package/dist/assets/image/empty-img.png +0 -0
  11. package/dist/assets/image/like_active.png +0 -0
  12. package/dist/assets/image/love.png +0 -0
  13. package/dist/assets/image/retry.png +0 -0
  14. package/dist/assets/image/soundOut.png +0 -0
  15. package/dist/assets/image/unlike_active.png +0 -0
  16. package/dist/assets/image/unlove.png +0 -0
  17. package/dist/assets/lottie/ai-bg.json +1704 -0
  18. package/dist/assets/lottie/ai-loading.json +192 -0
  19. package/dist/assets/lottie/ai-output-loading.json +272 -0
  20. package/dist/assets/lottie/ai-output-normal.json +17694 -0
  21. package/dist/assets/lottie/ai-output-strengthen.json +17321 -0
  22. package/dist/assets/lottie/ai-voice-play.json +1 -0
  23. package/dist/assets/lottie/living.json +705 -0
  24. package/dist/assets/lottie/myun-living.json +726 -0
  25. package/dist/assets/lottie/myun-loading.json +530 -0
  26. package/dist/components/ai-chat-dialogue/index.d.ts +16 -0
  27. package/dist/components/ai-chat-dialogue/index.js +1056 -0
  28. package/dist/components/ai-chat-dialogue/index.module.css +230 -0
  29. package/dist/components/ai-chat-dialogue/message-parser.d.ts +36 -0
  30. package/dist/components/ai-chat-dialogue/message-parser.js +52 -0
  31. package/dist/components/ai-chat-dialogue/tlv.d.ts +7 -0
  32. package/dist/components/ai-chat-dialogue/tlv.js +32 -0
  33. package/dist/components/ai-chat-dialogue/volc-voice-call-client.d.ts +47 -0
  34. package/dist/components/ai-chat-dialogue/volc-voice-call-client.js +246 -0
  35. package/dist/components/ai-correction/index.d.ts +5 -0
  36. package/dist/components/ai-correction/index.js +45 -0
  37. package/dist/components/ai-loading/index.d.ts +3 -0
  38. package/dist/components/ai-loading/index.js +14 -0
  39. package/dist/components/ai-loading/index.module.css +11 -0
  40. package/dist/components/answer-item/index.d.ts +27 -0
  41. package/dist/components/answer-item/index.js +194 -0
  42. package/dist/components/answer-item/index.module.css +266 -0
  43. package/dist/components/ask-card/index.d.ts +10 -0
  44. package/dist/components/ask-card/index.js +76 -0
  45. package/dist/components/ask-card/index.module.css +122 -0
  46. package/dist/components/chat-input/index.d.ts +31 -0
  47. package/dist/components/chat-input/index.js +433 -0
  48. package/dist/components/chat-input/index.module.css +42 -0
  49. package/dist/components/chat-voice/VoiceCommunication.d.ts +7 -0
  50. package/dist/components/chat-voice/VoiceCommunication.js +69 -0
  51. package/dist/components/chat-voice/VoiceRecord.d.ts +7 -0
  52. package/dist/components/chat-voice/VoiceRecord.js +34 -0
  53. package/dist/components/conversation-delete/index.d.ts +5 -0
  54. package/dist/components/conversation-delete/index.js +24 -0
  55. package/dist/components/dots-loading/index.d.ts +2 -0
  56. package/dist/components/dots-loading/index.js +11 -0
  57. package/dist/components/dots-loading/index.module.css +41 -0
  58. package/dist/components/empty/index.d.ts +9 -0
  59. package/dist/components/empty/index.js +32 -0
  60. package/dist/components/empty/index.module.css +24 -0
  61. package/dist/components/excel-components/ExcelCard.d.ts +11 -0
  62. package/dist/components/excel-components/ExcelCard.js +35 -0
  63. package/dist/components/excel-components/ExcelExcuting.d.ts +10 -0
  64. package/dist/components/excel-components/ExcelExcuting.js +263 -0
  65. package/dist/components/excel-components/ExcelFailCard.d.ts +9 -0
  66. package/dist/components/excel-components/ExcelFailCard.js +20 -0
  67. package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -0
  68. package/dist/components/excel-components/ExcelSuccessCard.js +50 -0
  69. package/dist/components/excel-components/index.module.css +212 -0
  70. package/dist/components/excel-components/styles.module.css +178 -0
  71. package/dist/components/file-card/fileCardSidebar.d.ts +8 -0
  72. package/dist/components/file-card/fileCardSidebar.js +56 -0
  73. package/dist/components/file-card/index.d.ts +15 -0
  74. package/dist/components/file-card/index.js +97 -0
  75. package/dist/components/file-card/index.module.css +139 -0
  76. package/dist/components/file-preview/index.d.ts +3 -0
  77. package/dist/components/file-preview/index.js +227 -0
  78. package/dist/components/file-preview/index.module.css +83 -0
  79. package/dist/components/file-upload/index.d.ts +16 -0
  80. package/dist/components/file-upload/index.js +238 -0
  81. package/dist/components/file-upload/uploadV1.d.ts +16 -0
  82. package/dist/components/file-upload/uploadV1.js +267 -0
  83. package/dist/components/gimi-sidebar/index.d.ts +17 -0
  84. package/dist/components/gimi-sidebar/index.js +41 -0
  85. package/dist/components/gimi-sidebar/index.module.css +118 -0
  86. package/dist/components/header/index.d.ts +5 -0
  87. package/dist/components/header/index.js +20 -0
  88. package/dist/components/header/index.module.css +19 -0
  89. package/dist/components/iconfont-com/index.d.ts +11 -0
  90. package/dist/components/iconfont-com/index.js +29 -0
  91. package/dist/components/index.d.ts +1 -0
  92. package/dist/components/index.js +1 -0
  93. package/dist/components/knowledge-trace/KnowledgeIconComponent.d.ts +7 -0
  94. package/dist/components/knowledge-trace/KnowledgeIconComponent.js +101 -0
  95. package/dist/components/knowledge-trace/classList.d.ts +6 -0
  96. package/dist/components/knowledge-trace/classList.js +72 -0
  97. package/dist/components/knowledge-trace/documentList.d.ts +6 -0
  98. package/dist/components/knowledge-trace/documentList.js +75 -0
  99. package/dist/components/knowledge-trace/index.d.ts +18 -0
  100. package/dist/components/knowledge-trace/index.js +155 -0
  101. package/dist/components/knowledge-trace/index.module.css +254 -0
  102. package/dist/components/knowledge-trace/interfaces.d.ts +166 -0
  103. package/dist/components/knowledge-trace/interfaces.js +1 -0
  104. package/dist/components/knowledge-trace/videoList.d.ts +6 -0
  105. package/dist/components/knowledge-trace/videoList.js +91 -0
  106. package/dist/components/lottie-img/index.d.ts +8 -0
  107. package/dist/components/lottie-img/index.js +99 -0
  108. package/dist/components/message-actions/CopyButton.d.ts +7 -0
  109. package/dist/components/message-actions/CopyButton.js +33 -0
  110. package/dist/components/message-actions/LikeButton.d.ts +7 -0
  111. package/dist/components/message-actions/LikeButton.js +34 -0
  112. package/dist/components/message-actions/RegenerateButton.d.ts +5 -0
  113. package/dist/components/message-actions/RegenerateButton.js +27 -0
  114. package/dist/components/message-actions/UnLikeButton.d.ts +7 -0
  115. package/dist/components/message-actions/UnLikeButton.js +34 -0
  116. package/dist/components/message-actions/VoicePlay.d.ts +10 -0
  117. package/dist/components/message-actions/VoicePlay.js +74 -0
  118. package/dist/components/message-list/index.d.ts +19 -0
  119. package/dist/components/message-list/index.js +164 -0
  120. package/dist/components/message-list/index.module.css +261 -0
  121. package/dist/components/no-microphone-root/index.d.ts +6 -0
  122. package/dist/components/no-microphone-root/index.js +36 -0
  123. package/dist/components/no-microphone-root/index.module.css +48 -0
  124. package/dist/components/preset-agent-content/index.d.ts +8 -0
  125. package/dist/components/preset-agent-content/index.js +24 -0
  126. package/dist/components/preset-agent-content/index.module.css +46 -0
  127. package/dist/components/quoted-content/index.d.ts +0 -0
  128. package/dist/components/quoted-content/index.js +171 -0
  129. package/dist/components/quoted-content/index.module.css +80 -0
  130. package/dist/components/reasoning-content/index.d.ts +6 -0
  131. package/dist/components/reasoning-content/index.js +116 -0
  132. package/dist/components/reasoning-content/index.module.css +169 -0
  133. package/dist/components/reference-content/index.d.ts +28 -0
  134. package/dist/components/reference-content/index.js +125 -0
  135. package/dist/components/reference-content/index.module.css +84 -0
  136. package/dist/components/templates/CommonChat.d.ts +5 -0
  137. package/dist/components/templates/CommonChat.js +218 -0
  138. package/dist/components/templates/GimiChatComponent.d.ts +4 -0
  139. package/dist/components/templates/GimiChatComponent.js +23 -0
  140. package/dist/components/templates/demo/demo.d.ts +2 -0
  141. package/dist/components/templates/demo/demo.js +109 -0
  142. package/dist/components/templates/index.module.css +109 -0
  143. package/dist/components/upload-list/index.d.ts +15 -0
  144. package/dist/components/upload-list/index.js +90 -0
  145. package/dist/components/upload-list/index.module.css +119 -0
  146. package/dist/components/voice-bars/index.d.ts +4 -0
  147. package/dist/components/voice-bars/index.js +174 -0
  148. package/dist/components/voice-check-dialog/index.d.ts +8 -0
  149. package/dist/components/voice-check-dialog/index.js +163 -0
  150. package/dist/components/voice-check-dialog/index.module.css +9 -0
  151. package/dist/components/voice-recording/index.d.ts +9 -0
  152. package/dist/components/voice-recording/index.js +54 -0
  153. package/dist/components/voice-recording/index.module.css +41 -0
  154. package/dist/components/work-flow-content/demo.d.ts +3 -0
  155. package/dist/components/work-flow-content/demo.js +11 -0
  156. package/dist/components/work-flow-content/index.d.ts +6 -0
  157. package/dist/components/work-flow-content/index.js +55 -0
  158. package/dist/components/work-flow-content/index.module.css +24 -0
  159. package/dist/constants.d.ts +24 -0
  160. package/dist/constants.js +24 -0
  161. package/dist/hooks/useChatActions.d.ts +12 -0
  162. package/dist/hooks/useChatActions.js +207 -0
  163. package/dist/hooks/useChatHistory.d.ts +8 -0
  164. package/dist/hooks/useChatHistory.js +225 -0
  165. package/dist/hooks/useChatMessage.d.ts +49 -0
  166. package/dist/hooks/useChatMessage.js +87 -0
  167. package/dist/hooks/useChatRecommend.d.ts +8 -0
  168. package/dist/hooks/useChatRecommend.js +126 -0
  169. package/dist/hooks/useChatStream.d.ts +20 -0
  170. package/dist/hooks/useChatStream.js +244 -0
  171. package/dist/hooks/useChatUI.d.ts +32 -0
  172. package/dist/hooks/useChatUI.js +134 -0
  173. package/dist/hooks/useChatVoice.d.ts +11 -0
  174. package/dist/hooks/useChatVoice.js +379 -0
  175. package/dist/hooks/useCommonChatAPI.d.ts +27 -0
  176. package/dist/hooks/useCommonChatAPI.js +1276 -0
  177. package/dist/hooks/useFile.d.ts +13 -0
  178. package/dist/hooks/useFile.js +288 -0
  179. package/dist/hooks/useKnowledgeService.d.ts +17 -0
  180. package/dist/hooks/useKnowledgeService.js +210 -0
  181. package/dist/hooks/useLastEventId.d.ts +8 -0
  182. package/dist/hooks/useLastEventId.js +66 -0
  183. package/dist/hooks/useLongPoll.d.ts +3 -0
  184. package/dist/hooks/useLongPoll.js +111 -0
  185. package/dist/hooks/useScroll.d.ts +4 -0
  186. package/dist/hooks/useScroll.js +172 -0
  187. package/dist/index.d.ts +1 -0
  188. package/dist/index.js +1 -0
  189. package/dist/interfaces/chatMessage.d.ts +139 -0
  190. package/dist/interfaces/fileInterface.d.ts +10 -0
  191. package/dist/interfaces/fileInterface.js +11 -0
  192. package/dist/interfaces/knowledgeTrace.d.ts +177 -0
  193. package/dist/store/hooks.d.ts +4 -0
  194. package/dist/store/hooks.js +3 -0
  195. package/dist/store/index.d.ts +7 -0
  196. package/dist/store/index.js +7 -0
  197. package/dist/store/slices/gimiMenuSlice.d.ts +95 -0
  198. package/dist/store/slices/gimiMenuSlice.js +251 -0
  199. package/dist/utils/chatInputUtil.d.ts +19 -0
  200. package/dist/utils/chatInputUtil.js +45 -0
  201. package/dist/utils/tools.d.ts +50 -0
  202. package/dist/utils/tools.js +474 -0
  203. package/dist/utils/voice-stream.d.ts +119 -0
  204. package/dist/utils/voice-stream.js +1162 -0
  205. package/package.json +5 -6
  206. package/LICENSE +0 -21
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { Button } from '@douyinfe/semi-ui';
3
+ import styles from "./index.module.css";
4
+ import { IconClose, IconMicrophoneOffStroked } from '@douyinfe/semi-icons';
5
+ export default function NoMicrophoneModalContent(_ref) {
6
+ var onOk = _ref.onOk;
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")));
36
+ }
@@ -0,0 +1,48 @@
1
+ .root {
2
+ width: 240px;
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: 12px;
6
+ }
7
+
8
+ .title {
9
+ font-size: 15px;
10
+ font-weight: 600;
11
+ color: #1f2d3d;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: space-between;
15
+ }
16
+
17
+ .desc {
18
+ width: 240px;
19
+ font-size: 12px;
20
+ color: rgba(31, 45, 61, 0.55);
21
+ }
22
+
23
+ .imgArea {
24
+ height: 100px;
25
+ border-radius: 12px;
26
+ background: linear-gradient(90deg, #e9f0ff 0%, #d7f1ff 100%);
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ }
31
+
32
+ .micIcon {
33
+ width: 56px;
34
+ height: 56px;
35
+ display: block;
36
+ }
37
+
38
+ .footer {
39
+ display: flex;
40
+ width: 100%;
41
+ justify-content: flex-end;
42
+ }
43
+
44
+ .okBtn {
45
+ height: 32px;
46
+ padding: 0 18px;
47
+ border-radius: 16px;
48
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface IProps {
3
+ prologue: string;
4
+ questionList: any[];
5
+ setInputValue: (value: string) => void;
6
+ }
7
+ declare const PresetAgentContent: React.FC<IProps>;
8
+ export default PresetAgentContent;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import styles from "./index.module.css";
3
+ var PresetAgentContent = function PresetAgentContent(_ref) {
4
+ var prologue = _ref.prologue,
5
+ questionList = _ref.questionList,
6
+ setInputValue = _ref.setInputValue;
7
+ if (!questionList || questionList.length === 0) return null;
8
+ return /*#__PURE__*/React.createElement("div", {
9
+ className: styles.container
10
+ }, prologue && /*#__PURE__*/React.createElement("div", {
11
+ className: styles.prologue
12
+ }, prologue), /*#__PURE__*/React.createElement("div", {
13
+ className: styles.quickInputList
14
+ }, questionList.map(function (item, index) {
15
+ return /*#__PURE__*/React.createElement("div", {
16
+ className: styles.quickInputItem,
17
+ key: index,
18
+ onClick: function onClick() {
19
+ return setInputValue(item.question);
20
+ }
21
+ }, item.question);
22
+ })));
23
+ };
24
+ export default PresetAgentContent;
@@ -0,0 +1,46 @@
1
+ @charset "UTF-8";
2
+ .container {
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: start;
6
+ padding: 14px 0px 20px 16px;
7
+ width: 100%;
8
+ }
9
+ .container .prologue {
10
+ font-family: PingFang SC;
11
+ font-weight: 400;
12
+ font-size: 16px;
13
+ line-height: 28px;
14
+ letter-spacing: 0px;
15
+ color: rgb(46, 57, 76);
16
+ }
17
+ .container .quickInputList {
18
+ width: 314px;
19
+ display: flex;
20
+ flex-direction: column;
21
+ gap: 10px;
22
+ flex-wrap: wrap;
23
+ margin-top: 10px;
24
+ }
25
+ .container .quickInputList .quickInputItem {
26
+ width: fit-content;
27
+ max-width: 314px;
28
+ padding: 5px 10px;
29
+ font-family: PingFangSC;
30
+ font-weight: 400;
31
+ font-size: 14px;
32
+ color: rgb(46, 57, 76);
33
+ line-height: 18px;
34
+ text-align: left;
35
+ font-style: normal;
36
+ border-radius: 8px;
37
+ border: 1px solid rgb(217, 220, 229);
38
+ flex-shrink: 0;
39
+ white-space: nowrap;
40
+ /* 禁止换行 */
41
+ overflow: hidden;
42
+ /* 隐藏溢出内容 */
43
+ text-overflow: ellipsis;
44
+ /* 显示省略号 */
45
+ cursor: pointer;
46
+ }
File without changes
@@ -0,0 +1,171 @@
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';
10
+
11
+ // const DEBOUNCE_MS = 600; // 拉长到 600 ms
12
+
13
+ // const tabList: any[] = [
14
+ // { key: 'video', displayName: '视频' },
15
+ // // { key: 'course', displayName: '课程' },
16
+ // ];
17
+
18
+ // interface Iprops {
19
+ // close: () => void;
20
+ // }
21
+
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 } });
33
+
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
+ // ];
49
+
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
+ // };
57
+
58
+ // // 触发搜索的函数
59
+ // const doSearch = (val: string) => {
60
+ // setSearchValue({ pageSize: 20, pageIndex: 1, inputValue: val });
61
+ // };
62
+
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
+ // };
@@ -0,0 +1,80 @@
1
+ .quotedContent {
2
+ flex: 1;
3
+ padding-top: 5px;
4
+ display: flex;
5
+ flex-direction: column;
6
+ height: 100%;
7
+ }
8
+
9
+ .searchInput {
10
+ line-height: 29px;
11
+ font-size: 12px;
12
+ padding: 0 10px;
13
+ border-radius: 8px;
14
+ }
15
+ .searchInput input::placeholder {
16
+ color: #7d91b3;
17
+ }
18
+
19
+ .content {
20
+ padding-top: 10px;
21
+ }
22
+
23
+ .newtab {
24
+ padding-bottom: 10px;
25
+ }
26
+
27
+ .tabItem {
28
+ font-size: 14px;
29
+ padding: 5px 10px;
30
+ margin: 0 8px;
31
+ border-radius: 8px;
32
+ cursor: pointer;
33
+ }
34
+ .tabItem:hover {
35
+ background-color: #f7f7fc;
36
+ color: #4086ff;
37
+ }
38
+
39
+ .active {
40
+ background-color: #f7f7fc;
41
+ color: #4086ff;
42
+ font-weight: 600;
43
+ }
44
+
45
+ .tabContent {
46
+ overflow: auto;
47
+ height: 200px;
48
+ }
49
+ .tabContent .table :global(.ant-table-content) {
50
+ font-size: 12px;
51
+ }
52
+ .tabContent .table :global(.ant-table-tbody > tr > td) {
53
+ border: none !important;
54
+ }
55
+ .tabContent .table .listItem {
56
+ display: flex;
57
+ align-items: center;
58
+ cursor: pointer;
59
+ }
60
+ .tabContent .table .listItem .img {
61
+ width: 16px;
62
+ margin-right: 5px;
63
+ }
64
+
65
+ .tabContent::-webkit-scrollbar {
66
+ width: 6px;
67
+ }
68
+
69
+ .tabContent::-webkit-scrollbar-track {
70
+ background: #f1f1f1;
71
+ }
72
+
73
+ .tabContent::-webkit-scrollbar-thumb {
74
+ background: #c1c1c1;
75
+ border-radius: 3px;
76
+ }
77
+
78
+ .tabContent::-webkit-scrollbar-thumb:hover {
79
+ background: #a8a8a8;
80
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { IChatMessageItem } from '../../interfaces/chatMessage';
3
+ declare const ResoningContent: React.FC<{
4
+ item: IChatMessageItem;
5
+ }>;
6
+ export default ResoningContent;
@@ -0,0 +1,116 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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); }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ /* eslint-disable react-hooks/exhaustive-deps */
14
+ import React, { useEffect, useRef, useCallback } from 'react';
15
+ import { MMarkdown } from '@myun/gimi-design';
16
+ // import SearchResult from '../search-result';
17
+ import styles from "./index.module.css";
18
+ import { processString } from "../../utils/tools";
19
+ import LottieImg from "../../components/lottie-img";
20
+ import useScroll from "../../hooks/useScroll";
21
+ import KnowledgeIconGroup from "../knowledge-trace/KnowledgeIconComponent";
22
+ import { IconChevronUp, IconChevronDown } from '@douyinfe/semi-icons';
23
+ import { useAppSelector, useAppDispatch } from "../../store/hooks";
24
+ import { setMessageList } from "../../store/slices/gimiMenuSlice";
25
+ var ResoningContent = function ResoningContent(_ref) {
26
+ var item = _ref.item;
27
+ var containerRef = useRef(null);
28
+ var _useScroll = useScroll(containerRef),
29
+ _useScroll2 = _slicedToArray(_useScroll, 1),
30
+ throttledScrollToBottom = _useScroll2[0];
31
+ var messageList = useAppSelector(function (state) {
32
+ return state.gimiMenu.messageList;
33
+ });
34
+ var messageListRef = useRef(messageList);
35
+ messageListRef.current = messageList;
36
+ var dispatch = useAppDispatch();
37
+ var updataChatList = React.useCallback(function (id, expand) {
38
+ var _messageListRef$curre;
39
+ var newMessageList = (_messageListRef$curre = messageListRef.current) === null || _messageListRef$curre === void 0 ? void 0 : _messageListRef$curre.map(function (item) {
40
+ if (item.id === id) {
41
+ return _objectSpread(_objectSpread({}, item), {}, {
42
+ expand: expand
43
+ });
44
+ }
45
+ return item;
46
+ });
47
+ dispatch(setMessageList({
48
+ messageList: newMessageList
49
+ }));
50
+ }, [messageList, dispatch]);
51
+ var handleClickExpand = useCallback(function () {
52
+ updataChatList(item.id, !item.expand);
53
+ }, [item.id, item.expand]);
54
+ useEffect(function () {
55
+ throttledScrollToBottom();
56
+ }, [item.reasoningContent]);
57
+ useEffect(function () {
58
+ if (item.reasoningStatus === 2) {
59
+ updataChatList(item.id, false);
60
+ }
61
+ }, [item.reasoningStatus]);
62
+ var renderStatusText = function renderStatusText() {
63
+ switch (item.reasoningStatus) {
64
+ case 1:
65
+ return '推理中';
66
+ case 2:
67
+ return '推理完成';
68
+ default:
69
+ return '推理已停止';
70
+ }
71
+ };
72
+ // item.expand ? styles.expand : ''
73
+ return /*#__PURE__*/React.createElement("div", {
74
+ className: styles.container
75
+ }, /*#__PURE__*/React.createElement("div", {
76
+ className: styles.header,
77
+ onClick: handleClickExpand
78
+ }, /*#__PURE__*/React.createElement("div", {
79
+ className: styles.title
80
+ }, "GIMI", renderStatusText()), item.expand ? /*#__PURE__*/React.createElement(IconChevronUp, null) : /*#__PURE__*/React.createElement(IconChevronDown, null)), item.expand ? /*#__PURE__*/React.createElement("div", {
81
+ className: styles.deeping,
82
+ ref: containerRef,
83
+ style: item.reasoningStatus === 1 ? {
84
+ maxHeight: 240
85
+ } : {}
86
+ }, /*#__PURE__*/React.createElement("div", {
87
+ className: styles.thinkQuery
88
+ }, item.query && /*#__PURE__*/React.createElement("div", {
89
+ className: styles.label,
90
+ style: {
91
+ marginTop: 0
92
+ }
93
+ }, "\u5F00\u59CB\u5206\u6790\u95EE\u9898"), item.query && /*#__PURE__*/React.createElement("div", {
94
+ className: styles.queryTitle
95
+ }, item.query)), /*#__PURE__*/React.createElement("div", {
96
+ className: styles.deepThink
97
+ }, item.query && /*#__PURE__*/React.createElement("div", {
98
+ className: styles.label
99
+ }, "\u8FDB\u884C\u6DF1\u5EA6\u601D\u8003"), item.reasoningContent && /*#__PURE__*/React.createElement("div", {
100
+ className: styles.deepThink_content
101
+ }, /*#__PURE__*/React.createElement(MMarkdown, {
102
+ content: processString(item.reasoningContent),
103
+ isDeep: true,
104
+ customRender: [{
105
+ type: 'knowledge',
106
+ component: KnowledgeIconGroup
107
+ }],
108
+ showLoading: item.reasoningLoading
109
+ }))), item.msgLoading && /*#__PURE__*/React.createElement("div", {
110
+ className: styles.answerLoading
111
+ }, /*#__PURE__*/React.createElement(LottieImg, {
112
+ name: "aiLoading",
113
+ size: [20, 40]
114
+ }))) : null);
115
+ };
116
+ export default ResoningContent;