@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.
- package/dist/apis/fetch.d.ts +64 -0
- package/dist/apis/fetch.js +512 -0
- package/dist/apis/useApi.d.ts +57 -0
- package/dist/apis/useApi.js +378 -0
- package/dist/assets/image/Subtract.png +0 -0
- package/dist/assets/image/ai-logo.png +0 -0
- package/dist/assets/image/copyIcon.png +0 -0
- package/dist/assets/image/deepthinkActive.png +0 -0
- package/dist/assets/image/empty-img-dark.png +0 -0
- package/dist/assets/image/empty-img.png +0 -0
- package/dist/assets/image/like_active.png +0 -0
- package/dist/assets/image/love.png +0 -0
- package/dist/assets/image/retry.png +0 -0
- package/dist/assets/image/soundOut.png +0 -0
- package/dist/assets/image/unlike_active.png +0 -0
- package/dist/assets/image/unlove.png +0 -0
- package/dist/assets/lottie/ai-bg.json +1704 -0
- package/dist/assets/lottie/ai-loading.json +192 -0
- package/dist/assets/lottie/ai-output-loading.json +272 -0
- package/dist/assets/lottie/ai-output-normal.json +17694 -0
- package/dist/assets/lottie/ai-output-strengthen.json +17321 -0
- package/dist/assets/lottie/ai-voice-play.json +1 -0
- package/dist/assets/lottie/living.json +705 -0
- package/dist/assets/lottie/myun-living.json +726 -0
- package/dist/assets/lottie/myun-loading.json +530 -0
- package/dist/components/ai-chat-dialogue/index.d.ts +16 -0
- package/dist/components/ai-chat-dialogue/index.js +1056 -0
- package/dist/components/ai-chat-dialogue/index.module.css +230 -0
- package/dist/components/ai-chat-dialogue/message-parser.d.ts +36 -0
- package/dist/components/ai-chat-dialogue/message-parser.js +52 -0
- package/dist/components/ai-chat-dialogue/tlv.d.ts +7 -0
- package/dist/components/ai-chat-dialogue/tlv.js +32 -0
- package/dist/components/ai-chat-dialogue/volc-voice-call-client.d.ts +47 -0
- package/dist/components/ai-chat-dialogue/volc-voice-call-client.js +246 -0
- package/dist/components/ai-correction/index.d.ts +5 -0
- package/dist/components/ai-correction/index.js +45 -0
- package/dist/components/ai-loading/index.d.ts +3 -0
- package/dist/components/ai-loading/index.js +14 -0
- package/dist/components/ai-loading/index.module.css +11 -0
- package/dist/components/answer-item/index.d.ts +27 -0
- package/dist/components/answer-item/index.js +194 -0
- package/dist/components/answer-item/index.module.css +266 -0
- package/dist/components/ask-card/index.d.ts +10 -0
- package/dist/components/ask-card/index.js +76 -0
- package/dist/components/ask-card/index.module.css +122 -0
- package/dist/components/chat-input/index.d.ts +31 -0
- package/dist/components/chat-input/index.js +433 -0
- package/dist/components/chat-input/index.module.css +42 -0
- package/dist/components/chat-voice/VoiceCommunication.d.ts +7 -0
- package/dist/components/chat-voice/VoiceCommunication.js +69 -0
- package/dist/components/chat-voice/VoiceRecord.d.ts +7 -0
- package/dist/components/chat-voice/VoiceRecord.js +34 -0
- package/dist/components/conversation-delete/index.d.ts +5 -0
- package/dist/components/conversation-delete/index.js +24 -0
- package/dist/components/dots-loading/index.d.ts +2 -0
- package/dist/components/dots-loading/index.js +11 -0
- package/dist/components/dots-loading/index.module.css +41 -0
- package/dist/components/empty/index.d.ts +9 -0
- package/dist/components/empty/index.js +32 -0
- package/dist/components/empty/index.module.css +24 -0
- package/dist/components/excel-components/ExcelCard.d.ts +11 -0
- package/dist/components/excel-components/ExcelCard.js +35 -0
- package/dist/components/excel-components/ExcelExcuting.d.ts +10 -0
- package/dist/components/excel-components/ExcelExcuting.js +263 -0
- package/dist/components/excel-components/ExcelFailCard.d.ts +9 -0
- package/dist/components/excel-components/ExcelFailCard.js +20 -0
- package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -0
- package/dist/components/excel-components/ExcelSuccessCard.js +50 -0
- package/dist/components/excel-components/index.module.css +212 -0
- package/dist/components/excel-components/styles.module.css +178 -0
- package/dist/components/file-card/fileCardSidebar.d.ts +8 -0
- package/dist/components/file-card/fileCardSidebar.js +56 -0
- package/dist/components/file-card/index.d.ts +15 -0
- package/dist/components/file-card/index.js +97 -0
- package/dist/components/file-card/index.module.css +139 -0
- package/dist/components/file-preview/index.d.ts +3 -0
- package/dist/components/file-preview/index.js +227 -0
- package/dist/components/file-preview/index.module.css +83 -0
- package/dist/components/file-upload/index.d.ts +16 -0
- package/dist/components/file-upload/index.js +238 -0
- package/dist/components/file-upload/uploadV1.d.ts +16 -0
- package/dist/components/file-upload/uploadV1.js +267 -0
- package/dist/components/gimi-sidebar/index.d.ts +17 -0
- package/dist/components/gimi-sidebar/index.js +41 -0
- package/dist/components/gimi-sidebar/index.module.css +118 -0
- package/dist/components/header/index.d.ts +5 -0
- package/dist/components/header/index.js +20 -0
- package/dist/components/header/index.module.css +19 -0
- package/dist/components/iconfont-com/index.d.ts +11 -0
- package/dist/components/iconfont-com/index.js +29 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/knowledge-trace/KnowledgeIconComponent.d.ts +7 -0
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +101 -0
- package/dist/components/knowledge-trace/classList.d.ts +6 -0
- package/dist/components/knowledge-trace/classList.js +72 -0
- package/dist/components/knowledge-trace/documentList.d.ts +6 -0
- package/dist/components/knowledge-trace/documentList.js +75 -0
- package/dist/components/knowledge-trace/index.d.ts +18 -0
- package/dist/components/knowledge-trace/index.js +155 -0
- package/dist/components/knowledge-trace/index.module.css +254 -0
- package/dist/components/knowledge-trace/interfaces.d.ts +166 -0
- package/dist/components/knowledge-trace/interfaces.js +1 -0
- package/dist/components/knowledge-trace/videoList.d.ts +6 -0
- package/dist/components/knowledge-trace/videoList.js +91 -0
- package/dist/components/lottie-img/index.d.ts +8 -0
- package/dist/components/lottie-img/index.js +99 -0
- package/dist/components/message-actions/CopyButton.d.ts +7 -0
- package/dist/components/message-actions/CopyButton.js +33 -0
- package/dist/components/message-actions/LikeButton.d.ts +7 -0
- package/dist/components/message-actions/LikeButton.js +34 -0
- package/dist/components/message-actions/RegenerateButton.d.ts +5 -0
- package/dist/components/message-actions/RegenerateButton.js +27 -0
- package/dist/components/message-actions/UnLikeButton.d.ts +7 -0
- package/dist/components/message-actions/UnLikeButton.js +34 -0
- package/dist/components/message-actions/VoicePlay.d.ts +10 -0
- package/dist/components/message-actions/VoicePlay.js +74 -0
- package/dist/components/message-list/index.d.ts +19 -0
- package/dist/components/message-list/index.js +164 -0
- package/dist/components/message-list/index.module.css +261 -0
- package/dist/components/no-microphone-root/index.d.ts +6 -0
- package/dist/components/no-microphone-root/index.js +36 -0
- package/dist/components/no-microphone-root/index.module.css +48 -0
- package/dist/components/preset-agent-content/index.d.ts +8 -0
- package/dist/components/preset-agent-content/index.js +24 -0
- package/dist/components/preset-agent-content/index.module.css +46 -0
- package/dist/components/quoted-content/index.d.ts +0 -0
- package/dist/components/quoted-content/index.js +171 -0
- package/dist/components/quoted-content/index.module.css +80 -0
- package/dist/components/reasoning-content/index.d.ts +6 -0
- package/dist/components/reasoning-content/index.js +116 -0
- package/dist/components/reasoning-content/index.module.css +169 -0
- package/dist/components/reference-content/index.d.ts +28 -0
- package/dist/components/reference-content/index.js +125 -0
- package/dist/components/reference-content/index.module.css +84 -0
- package/dist/components/templates/CommonChat.d.ts +5 -0
- package/dist/components/templates/CommonChat.js +218 -0
- package/dist/components/templates/GimiChatComponent.d.ts +4 -0
- package/dist/components/templates/GimiChatComponent.js +23 -0
- package/dist/components/templates/demo/demo.d.ts +2 -0
- package/dist/components/templates/demo/demo.js +109 -0
- package/dist/components/templates/index.module.css +109 -0
- package/dist/components/upload-list/index.d.ts +15 -0
- package/dist/components/upload-list/index.js +90 -0
- package/dist/components/upload-list/index.module.css +119 -0
- package/dist/components/voice-bars/index.d.ts +4 -0
- package/dist/components/voice-bars/index.js +174 -0
- package/dist/components/voice-check-dialog/index.d.ts +8 -0
- package/dist/components/voice-check-dialog/index.js +163 -0
- package/dist/components/voice-check-dialog/index.module.css +9 -0
- package/dist/components/voice-recording/index.d.ts +9 -0
- package/dist/components/voice-recording/index.js +54 -0
- package/dist/components/voice-recording/index.module.css +41 -0
- package/dist/components/work-flow-content/demo.d.ts +3 -0
- package/dist/components/work-flow-content/demo.js +11 -0
- package/dist/components/work-flow-content/index.d.ts +6 -0
- package/dist/components/work-flow-content/index.js +55 -0
- package/dist/components/work-flow-content/index.module.css +24 -0
- package/dist/constants.d.ts +24 -0
- package/dist/constants.js +24 -0
- package/dist/hooks/useChatActions.d.ts +12 -0
- package/dist/hooks/useChatActions.js +207 -0
- package/dist/hooks/useChatHistory.d.ts +8 -0
- package/dist/hooks/useChatHistory.js +225 -0
- package/dist/hooks/useChatMessage.d.ts +49 -0
- package/dist/hooks/useChatMessage.js +87 -0
- package/dist/hooks/useChatRecommend.d.ts +8 -0
- package/dist/hooks/useChatRecommend.js +126 -0
- package/dist/hooks/useChatStream.d.ts +20 -0
- package/dist/hooks/useChatStream.js +244 -0
- package/dist/hooks/useChatUI.d.ts +32 -0
- package/dist/hooks/useChatUI.js +134 -0
- package/dist/hooks/useChatVoice.d.ts +11 -0
- package/dist/hooks/useChatVoice.js +379 -0
- package/dist/hooks/useCommonChatAPI.d.ts +27 -0
- package/dist/hooks/useCommonChatAPI.js +1276 -0
- package/dist/hooks/useFile.d.ts +13 -0
- package/dist/hooks/useFile.js +288 -0
- package/dist/hooks/useKnowledgeService.d.ts +17 -0
- package/dist/hooks/useKnowledgeService.js +210 -0
- package/dist/hooks/useLastEventId.d.ts +8 -0
- package/dist/hooks/useLastEventId.js +66 -0
- package/dist/hooks/useLongPoll.d.ts +3 -0
- package/dist/hooks/useLongPoll.js +111 -0
- package/dist/hooks/useScroll.d.ts +4 -0
- package/dist/hooks/useScroll.js +172 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/chatMessage.d.ts +139 -0
- package/dist/interfaces/fileInterface.d.ts +10 -0
- package/dist/interfaces/fileInterface.js +11 -0
- package/dist/interfaces/knowledgeTrace.d.ts +177 -0
- package/dist/store/hooks.d.ts +4 -0
- package/dist/store/hooks.js +3 -0
- package/dist/store/index.d.ts +7 -0
- package/dist/store/index.js +7 -0
- package/dist/store/slices/gimiMenuSlice.d.ts +95 -0
- package/dist/store/slices/gimiMenuSlice.js +251 -0
- package/dist/utils/chatInputUtil.d.ts +19 -0
- package/dist/utils/chatInputUtil.js +45 -0
- package/dist/utils/tools.d.ts +50 -0
- package/dist/utils/tools.js +474 -0
- package/dist/utils/voice-stream.d.ts +119 -0
- package/dist/utils/voice-stream.js +1162 -0
- package/package.json +5 -6
- 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,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,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;
|