@myun/gimi-chat 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/useApi.d.ts +1 -1
- package/dist/apis/useApi.js +3 -3
- package/dist/assets/image/addChat.png +0 -0
- package/dist/client/components/common-chat/index.d.ts +5 -0
- package/dist/client/components/common-chat/index.js +207 -0
- package/dist/client/components/common-chat/index.module.css +109 -0
- package/dist/client/components/history-list/index.d.ts +5 -0
- package/dist/client/components/history-list/index.js +281 -0
- package/dist/client/components/history-list/index.module.css +127 -0
- package/dist/client/components/new-main/index.css +34 -0
- package/dist/client/components/new-main/index.d.ts +4 -0
- package/dist/client/components/new-main/index.js +140 -0
- package/dist/client/components/slider/index.css +249 -0
- package/dist/client/components/slider/index.d.ts +4 -0
- package/dist/client/components/slider/index.js +70 -0
- package/dist/client/core/chat.d.ts +5 -0
- package/dist/client/core/chat.js +109 -0
- package/dist/client/core/index.css +17 -0
- package/dist/client/core/index.d.ts +3 -0
- package/dist/client/core/index.js +10 -0
- package/dist/client/index.d.ts +18 -0
- package/dist/client/index.js +26 -0
- package/dist/components/answer-item/index.js +1 -1
- package/dist/components/chat-input/index.js +10 -21
- package/dist/components/preset-agent-content/index.module.css +1 -1
- package/dist/components/templates/CommonChat.js +19 -4
- package/dist/hooks/useChatHistory.js +1 -1
- package/dist/hooks/useCommonChatAPI.js +2 -2
- package/dist/store/slices/gimiMenuSlice.d.ts +1 -0
- package/dist/store/slices/gimiMenuSlice.js +25 -15
- package/dist/umd/index.min.js +1 -0
- package/package.json +1 -1
package/dist/apis/useApi.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FetchResponse } from './fetch';
|
|
2
2
|
import { IProduct, ITeachingModuleResource, IVideoResource } from '../interfaces/knowledgeTrace';
|
|
3
|
-
declare const useApi: () => {
|
|
3
|
+
declare const useApi: (baseUrl?: string, authToken?: string) => {
|
|
4
4
|
getSkillData: (requestId: number) => Promise<FetchResponse<any>>;
|
|
5
5
|
getProductList: (params: {
|
|
6
6
|
productIds: string[];
|
package/dist/apis/useApi.js
CHANGED
|
@@ -5,11 +5,11 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
5
5
|
import { createFetch } from "./fetch";
|
|
6
6
|
import { useAppSelector } from "../store/hooks";
|
|
7
7
|
import React from 'react';
|
|
8
|
-
var useApi = function useApi() {
|
|
9
|
-
var token = useAppSelector(function (state) {
|
|
8
|
+
var useApi = function useApi(baseUrl, authToken) {
|
|
9
|
+
var token = authToken || useAppSelector(function (state) {
|
|
10
10
|
return state.gimiMenu.token;
|
|
11
11
|
});
|
|
12
|
-
var baseURL = useAppSelector(function (state) {
|
|
12
|
+
var baseURL = baseUrl || useAppSelector(function (state) {
|
|
13
13
|
return state.gimiMenu.baseUrl;
|
|
14
14
|
});
|
|
15
15
|
var apiRef = React.useRef(createFetch({
|
|
Binary file
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonChatProps } from '../../../types/chat';
|
|
3
|
+
import { CommonChatRef } from '../../../types/chat';
|
|
4
|
+
declare const CommonChat: React.ForwardRefExoticComponent<CommonChatProps & React.RefAttributes<CommonChatRef>>;
|
|
5
|
+
export default CommonChat;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { store } from "../../../store";
|
|
4
|
+
import { useAppDispatch, useAppSelector } from "../../../store/hooks";
|
|
5
|
+
import { setBussinessParams } from "../../../store/slices/gimiMenuSlice";
|
|
6
|
+
import useCommonChatAPI from "../../../hooks/useCommonChatAPI";
|
|
7
|
+
import { replaceBraces } from "../../../utils/tools";
|
|
8
|
+
import styles from "./index.module.css";
|
|
9
|
+
import ChatInput from "../../../components/chat-input";
|
|
10
|
+
import MessageList from "../../../components/message-list";
|
|
11
|
+
import PresetAgentContent from "../../../components/preset-agent-content";
|
|
12
|
+
import useChatVoice from "../../../hooks/useChatVoice";
|
|
13
|
+
import { useChatUI } from "../../../hooks/useChatUI";
|
|
14
|
+
import { IconChevronDown } from '@douyinfe/semi-icons';
|
|
15
|
+
import KonwledgeTrace from "../../../components/knowledge-trace";
|
|
16
|
+
import FileCardSideBar from "../../../components/file-card/fileCardSidebar";
|
|
17
|
+
import OfficeFilePreviewPanel from "../../../components/file-preview";
|
|
18
|
+
import AiLoading from "../../../components/ai-loading";
|
|
19
|
+
var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
20
|
+
var _props$businessType = props.businessType,
|
|
21
|
+
businessType = _props$businessType === void 0 ? 'chat' : _props$businessType,
|
|
22
|
+
_props$showInput = props.showInput,
|
|
23
|
+
showInput = _props$showInput === void 0 ? true : _props$showInput,
|
|
24
|
+
_props$showHeader = props.showHeader,
|
|
25
|
+
showHeader = _props$showHeader === void 0 ? true : _props$showHeader,
|
|
26
|
+
_props$chatInputConfi = props.chatInputConfig,
|
|
27
|
+
chatInputConfig = _props$chatInputConfi === void 0 ? {
|
|
28
|
+
enableVoiceRecord: true,
|
|
29
|
+
enableVoiceChat: true,
|
|
30
|
+
enableFileUpload: true
|
|
31
|
+
} : _props$chatInputConfi,
|
|
32
|
+
_props$defaultMessage = props.defaultMessages,
|
|
33
|
+
defaultMessages = _props$defaultMessage === void 0 ? [] : _props$defaultMessage,
|
|
34
|
+
agentId = props.agentId,
|
|
35
|
+
_props$showPrologue = props.showPrologue,
|
|
36
|
+
showPrologue = _props$showPrologue === void 0 ? true : _props$showPrologue,
|
|
37
|
+
_props$model = props.model,
|
|
38
|
+
model = _props$model === void 0 ? 'fullscreen' : _props$model,
|
|
39
|
+
conversationId = props.conversationId,
|
|
40
|
+
bussinessParams = props.bussinessParams;
|
|
41
|
+
var dispatch = useAppDispatch();
|
|
42
|
+
var containerRef = React.useRef(null);
|
|
43
|
+
var chatInputRef = React.useRef(null);
|
|
44
|
+
var messageList = useAppSelector(function (state) {
|
|
45
|
+
return state.gimiMenu.messageList;
|
|
46
|
+
});
|
|
47
|
+
var agentObj = useAppSelector(function (state) {
|
|
48
|
+
return state.gimiMenu.agentObj;
|
|
49
|
+
});
|
|
50
|
+
var storedBaseUrl = useAppSelector(function (state) {
|
|
51
|
+
return state.gimiMenu.baseUrl;
|
|
52
|
+
});
|
|
53
|
+
var storedToken = useAppSelector(function (state) {
|
|
54
|
+
return state.gimiMenu.token;
|
|
55
|
+
});
|
|
56
|
+
var initMsg = useAppSelector(function (state) {
|
|
57
|
+
return state.gimiMenu.initMsg;
|
|
58
|
+
});
|
|
59
|
+
var chatUI = useChatUI();
|
|
60
|
+
var _useChatVoice = useChatVoice(),
|
|
61
|
+
isRecording = _useChatVoice.isRecording,
|
|
62
|
+
recordingCount = _useChatVoice.recordingCount,
|
|
63
|
+
asrText = _useChatVoice.asrText,
|
|
64
|
+
shortAsrClick = _useChatVoice.shortAsrClick,
|
|
65
|
+
isExecuting = _useChatVoice.isExecuting,
|
|
66
|
+
playTTSByText = _useChatVoice.playTTSByText,
|
|
67
|
+
stopTTSByText = _useChatVoice.stopTTSByText,
|
|
68
|
+
isPlaying = _useChatVoice.isPlaying;
|
|
69
|
+
var _useCommonChatAPI = useCommonChatAPI(containerRef, businessType, stopTTSByText, isPlaying, agentId),
|
|
70
|
+
headerValue = _useCommonChatAPI.headerValue,
|
|
71
|
+
msgLoading = _useCommonChatAPI.msgLoading,
|
|
72
|
+
onSucessExcel = _useCommonChatAPI.onSucessExcel,
|
|
73
|
+
handleInterrupt = _useCommonChatAPI.handleInterrupt,
|
|
74
|
+
onFailureExcel = _useCommonChatAPI.onFailureExcel,
|
|
75
|
+
onRetryExcel = _useCommonChatAPI.onRetryExcel,
|
|
76
|
+
disableSend = _useCommonChatAPI.disableSend,
|
|
77
|
+
inputModelRef = _useCommonChatAPI.inputModelRef,
|
|
78
|
+
isMoreLoading = _useCommonChatAPI.isMoreLoading,
|
|
79
|
+
startConversationAndChat = _useCommonChatAPI.startConversationAndChat,
|
|
80
|
+
getContentMessageList = _useCommonChatAPI.getContentMessageList,
|
|
81
|
+
hasMore = _useCommonChatAPI.hasMore,
|
|
82
|
+
handleSend = _useCommonChatAPI.handleSend,
|
|
83
|
+
scrollBottomForce = _useCommonChatAPI.scrollBottomForce,
|
|
84
|
+
showBackBottom = _useCommonChatAPI.showBackBottom,
|
|
85
|
+
isScrolling = _useCommonChatAPI.isScrolling,
|
|
86
|
+
regenerate = _useCommonChatAPI.regenerate,
|
|
87
|
+
startAICorrection = _useCommonChatAPI.startAICorrection;
|
|
88
|
+
React.useImperativeHandle(ref, function () {
|
|
89
|
+
return {
|
|
90
|
+
messageList: messageList,
|
|
91
|
+
agentDetail: agentObj,
|
|
92
|
+
conversationId: store.getState().gimiMenu.conversationId,
|
|
93
|
+
inputEditor: chatInputRef.current
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
React.useEffect(function () {
|
|
97
|
+
// 组件初始化
|
|
98
|
+
dispatch(setBussinessParams({
|
|
99
|
+
bussinessParams: bussinessParams || {}
|
|
100
|
+
}));
|
|
101
|
+
}, [bussinessParams]);
|
|
102
|
+
React.useEffect(function () {
|
|
103
|
+
if (bussinessParams !== null && bussinessParams !== void 0 && bussinessParams.QUESTION_ID && bussinessParams !== null && bussinessParams !== void 0 && bussinessParams.ANSWER_ID && businessType === 'correction' && storedBaseUrl && storedToken) {
|
|
104
|
+
startAICorrection(bussinessParams.ANSWER_ID, bussinessParams.QUESTION_ID);
|
|
105
|
+
}
|
|
106
|
+
}, [bussinessParams, storedBaseUrl, storedToken, businessType]);
|
|
107
|
+
var disableVoiceCommunication = React.useMemo(function () {
|
|
108
|
+
var lastedMessage = messageList[messageList.length - 1];
|
|
109
|
+
var content = (lastedMessage === null || lastedMessage === void 0 ? void 0 : lastedMessage.content) || '';
|
|
110
|
+
if (content.indexOf('<excel>') > -1) return true;
|
|
111
|
+
if (['ask', 'skill'].includes((lastedMessage === null || lastedMessage === void 0 ? void 0 : lastedMessage.moduleType) || '')) return true;
|
|
112
|
+
return false;
|
|
113
|
+
}, [messageList]);
|
|
114
|
+
var onHistoryReload = function onHistoryReload() {
|
|
115
|
+
hasMore.current = true;
|
|
116
|
+
getContentMessageList(1, 10);
|
|
117
|
+
};
|
|
118
|
+
var setInputValue = React.useCallback(function (content) {
|
|
119
|
+
var _chatInputRef$current;
|
|
120
|
+
(_chatInputRef$current = chatInputRef.current) === null || _chatInputRef$current === void 0 || _chatInputRef$current.setValue(content);
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
// const onInputValueChange = React.useCallback((content: string) => {
|
|
124
|
+
// setInputValue(content);
|
|
125
|
+
// }, []);
|
|
126
|
+
|
|
127
|
+
var handleInputSend = React.useCallback(function (val, agent, isSystemAuto) {
|
|
128
|
+
var _chatInputRef$current2;
|
|
129
|
+
(_chatInputRef$current2 = chatInputRef.current) === null || _chatInputRef$current2 === void 0 || _chatInputRef$current2.setValue('');
|
|
130
|
+
if (!conversationId) {
|
|
131
|
+
startConversationAndChat(val);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
handleSend(val, agent, isSystemAuto);
|
|
135
|
+
}, [handleSend, startConversationAndChat, conversationId]);
|
|
136
|
+
useEffect(function () {
|
|
137
|
+
if (initMsg) {
|
|
138
|
+
handleInputSend(initMsg);
|
|
139
|
+
}
|
|
140
|
+
}, [initMsg]);
|
|
141
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: styles.main,
|
|
143
|
+
id: "myun_gimi_design_chat"
|
|
144
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
className: styles.chat_content
|
|
146
|
+
}, showHeader && headerValue && /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
className: styles.content_header
|
|
148
|
+
}, replaceBraces(headerValue)), /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
className: styles.scroll_wrapper
|
|
150
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: "".concat(styles.scroll_container, " ").concat(isScrolling ? styles.scrolling : ''),
|
|
152
|
+
ref: containerRef
|
|
153
|
+
}, showPrologue && messageList.length === 0 && !isMoreLoading && /*#__PURE__*/React.createElement(PresetAgentContent, {
|
|
154
|
+
prologue: (agentObj === null || agentObj === void 0 ? void 0 : agentObj.prologue) || '',
|
|
155
|
+
questionList: (agentObj === null || agentObj === void 0 ? void 0 : agentObj.questionList) || [],
|
|
156
|
+
setInputValue: setInputValue
|
|
157
|
+
}), isMoreLoading ? /*#__PURE__*/React.createElement("div", {
|
|
158
|
+
style: {
|
|
159
|
+
height: '100%'
|
|
160
|
+
}
|
|
161
|
+
}, /*#__PURE__*/React.createElement(AiLoading, null)) : /*#__PURE__*/React.createElement(MessageList, _extends({
|
|
162
|
+
chatList: messageList || defaultMessages,
|
|
163
|
+
handleSend: handleSend,
|
|
164
|
+
inputModelRef: inputModelRef,
|
|
165
|
+
msgLoading: msgLoading,
|
|
166
|
+
onSucessExcel: onSucessExcel,
|
|
167
|
+
onFailureExcel: onFailureExcel,
|
|
168
|
+
onRegenerateClick: regenerate,
|
|
169
|
+
onRetryExcel: onRetryExcel,
|
|
170
|
+
chatUI: chatUI,
|
|
171
|
+
model: model,
|
|
172
|
+
isPlaying: isPlaying,
|
|
173
|
+
playTTSByText: playTTSByText,
|
|
174
|
+
stopTTSByText: stopTTSByText
|
|
175
|
+
}, props.messageConfig))), showBackBottom && /*#__PURE__*/React.createElement("div", {
|
|
176
|
+
className: styles.backBottomBtn,
|
|
177
|
+
onClick: function onClick() {
|
|
178
|
+
return scrollBottomForce(true);
|
|
179
|
+
}
|
|
180
|
+
}, /*#__PURE__*/React.createElement(IconChevronDown, {
|
|
181
|
+
size: "large"
|
|
182
|
+
}))), showInput && /*#__PURE__*/React.createElement(ChatInput, _extends({
|
|
183
|
+
ref: chatInputRef
|
|
184
|
+
}, chatInputConfig, {
|
|
185
|
+
onSend: handleInputSend,
|
|
186
|
+
disabled: disableSend || isMoreLoading,
|
|
187
|
+
defaultPrompt: messageList.length > 0 ? '' : (agentObj === null || agentObj === void 0 ? void 0 : agentObj.defaultPrompt) || '',
|
|
188
|
+
titleSlot: messageList.length > 0 ? '' : (agentObj === null || agentObj === void 0 ? void 0 : agentObj.agentName) || '',
|
|
189
|
+
showDefaultPrompt: messageList.length === 0
|
|
190
|
+
// onContentChange={onInputValueChange}
|
|
191
|
+
,
|
|
192
|
+
onInterrupt: handleInterrupt,
|
|
193
|
+
isRecording: isRecording,
|
|
194
|
+
isVoiceGetting: isExecuting,
|
|
195
|
+
recordingCount: recordingCount,
|
|
196
|
+
asrText: asrText,
|
|
197
|
+
shortAsrClick: shortAsrClick,
|
|
198
|
+
disableVoiceCommunication: disableVoiceCommunication,
|
|
199
|
+
onHistoryReload: onHistoryReload
|
|
200
|
+
}, props.chatInputConfig))), /*#__PURE__*/React.createElement(KonwledgeTrace, _extends({}, props.sidebarConfig, {
|
|
201
|
+
chatList: messageList || defaultMessages,
|
|
202
|
+
isOverFlow: model === 'fullscreen' ? false : true
|
|
203
|
+
})), /*#__PURE__*/React.createElement(FileCardSideBar, _extends({}, props.sidebarConfig, {
|
|
204
|
+
isOverFlow: model === 'fullscreen' ? false : true
|
|
205
|
+
})), /*#__PURE__*/React.createElement(OfficeFilePreviewPanel, null));
|
|
206
|
+
});
|
|
207
|
+
export default CommonChat;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.main {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
gap: 20px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.chat_content {
|
|
12
|
+
flex: 1;
|
|
13
|
+
height: 100%;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.scroll_wrapper {
|
|
21
|
+
flex: 1;
|
|
22
|
+
position: relative;
|
|
23
|
+
width: 100%;
|
|
24
|
+
min-height: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.scroll_container {
|
|
28
|
+
height: 100%;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
overflow-x: hidden;
|
|
31
|
+
width: 100%;
|
|
32
|
+
position: relative;
|
|
33
|
+
}
|
|
34
|
+
.scroll_container::-webkit-scrollbar {
|
|
35
|
+
width: 6px;
|
|
36
|
+
height: 6px;
|
|
37
|
+
}
|
|
38
|
+
.scroll_container::-webkit-scrollbar-thumb {
|
|
39
|
+
border-radius: 6px;
|
|
40
|
+
background: transparent;
|
|
41
|
+
}
|
|
42
|
+
.scroll_container::-webkit-scrollbar-track {
|
|
43
|
+
background: transparent;
|
|
44
|
+
border-radius: 6px;
|
|
45
|
+
}
|
|
46
|
+
.scroll_container.scrolling::-webkit-scrollbar-thumb {
|
|
47
|
+
background: rgba(144, 147, 153, 0.3);
|
|
48
|
+
}
|
|
49
|
+
.scroll_container::-webkit-scrollbar-thumb:hover {
|
|
50
|
+
background: rgba(144, 147, 153, 0.5);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.backBottomBtn {
|
|
54
|
+
position: absolute;
|
|
55
|
+
bottom: 20px;
|
|
56
|
+
right: 20px;
|
|
57
|
+
width: 40px;
|
|
58
|
+
height: 40px;
|
|
59
|
+
background: #fff;
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.1);
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
z-index: 10;
|
|
67
|
+
transition: all 0.3s;
|
|
68
|
+
color: #1c1f23;
|
|
69
|
+
}
|
|
70
|
+
.backBottomBtn:hover {
|
|
71
|
+
background: #f2f3f5;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.content_header {
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 50px;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
font-family: PingFangSC, PingFang SC;
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
font-size: 16px;
|
|
83
|
+
color: #2e394c;
|
|
84
|
+
line-height: 22px;
|
|
85
|
+
text-align: center;
|
|
86
|
+
font-style: normal;
|
|
87
|
+
position: relative;
|
|
88
|
+
}
|
|
89
|
+
.content_header .content_header_title {
|
|
90
|
+
width: 340px;
|
|
91
|
+
height: 100%;
|
|
92
|
+
line-height: 50px;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
/* 隐藏溢出内容 */
|
|
95
|
+
white-space: nowrap;
|
|
96
|
+
/* 强制文本不换行 */
|
|
97
|
+
text-overflow: ellipsis;
|
|
98
|
+
/* 超出部分显示省略号 */
|
|
99
|
+
}
|
|
100
|
+
.content_header .text_shanow {
|
|
101
|
+
z-index: 5;
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
background: linear-gradient(rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 100%);
|
|
104
|
+
width: 97%;
|
|
105
|
+
height: 32px;
|
|
106
|
+
position: absolute;
|
|
107
|
+
top: 100%;
|
|
108
|
+
left: 1px;
|
|
109
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
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 _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; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
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); }
|
|
5
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
6
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
7
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
15
|
+
import { Modal, Popover, Button, Spin, Toast } from '@douyinfe/semi-ui';
|
|
16
|
+
// import { removeChat } from '@/apis/gimi';
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import IconFont from "../../../components/iconfont-com";
|
|
19
|
+
import styles from "./index.module.css";
|
|
20
|
+
import { replaceBraces } from "../../../utils/tools";
|
|
21
|
+
import { useAppDispatch, useAppSelector } from "../../../store/hooks";
|
|
22
|
+
import { getChatHistoryList } from "../../../store/slices/gimiMenuSlice";
|
|
23
|
+
import useApi from "../../../apis/useApi";
|
|
24
|
+
var confirm = Modal.confirm;
|
|
25
|
+
var hostoryItemIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202508/28/c5b09_20250828113135.png';
|
|
26
|
+
var chatlistHover = 'https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202601/23/9a669_20260123133853.png';
|
|
27
|
+
var chatlistIcon = 'https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202601/23/e9b4a_20260123133925.png';
|
|
28
|
+
var HistoryList = function HistoryList() {
|
|
29
|
+
var _useAppSelector = useAppSelector(function (state) {
|
|
30
|
+
return state.gimiMenu;
|
|
31
|
+
}),
|
|
32
|
+
baseUrl = _useAppSelector.baseUrl,
|
|
33
|
+
conversationId = _useAppSelector.conversationId,
|
|
34
|
+
historyList = _useAppSelector.historyList,
|
|
35
|
+
loadingMore = _useAppSelector.loadingMore,
|
|
36
|
+
_useAppSelector$hasMo = _useAppSelector.hasMore,
|
|
37
|
+
hasMore = _useAppSelector$hasMo === void 0 ? true : _useAppSelector$hasMo,
|
|
38
|
+
loading = _useAppSelector.loading,
|
|
39
|
+
params = _useAppSelector.params;
|
|
40
|
+
var _useApi = useApi(),
|
|
41
|
+
deleteConversationById = _useApi.deleteConversationById;
|
|
42
|
+
var _useState = useState(null),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
hoveredIndex = _useState2[0],
|
|
45
|
+
setHoveredIndex = _useState2[1];
|
|
46
|
+
var listRef = useRef(null);
|
|
47
|
+
var dispatch = useAppDispatch();
|
|
48
|
+
var loadMoreData = function loadMoreData() {
|
|
49
|
+
if (!loading && !loadingMore && hasMore) {
|
|
50
|
+
var nextPage = params.pageIndex + 1;
|
|
51
|
+
// dispatch({
|
|
52
|
+
// type: 'gimiMenu/updateParams',
|
|
53
|
+
// payload: { pageIndex: nextPage },
|
|
54
|
+
// });
|
|
55
|
+
dispatch(getChatHistoryList({
|
|
56
|
+
pageIndex: nextPage,
|
|
57
|
+
pageSize: params.pageSize,
|
|
58
|
+
loadMore: true
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
// 处理滚动事件
|
|
63
|
+
var handleScroll = useCallback(function () {
|
|
64
|
+
if (listRef.current && hasMore && !loadingMore) {
|
|
65
|
+
var _listRef$current = listRef.current,
|
|
66
|
+
scrollTop = _listRef$current.scrollTop,
|
|
67
|
+
scrollHeight = _listRef$current.scrollHeight,
|
|
68
|
+
clientHeight = _listRef$current.clientHeight;
|
|
69
|
+
// 当滚动到距离底部50px时触发加载
|
|
70
|
+
if (scrollHeight - (scrollTop + clientHeight) < 50) {
|
|
71
|
+
loadMoreData();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, [loadMoreData, hasMore, loadingMore]);
|
|
75
|
+
|
|
76
|
+
// 添加滚动事件监听
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
var currentRef = listRef.current;
|
|
79
|
+
if (currentRef) {
|
|
80
|
+
currentRef.addEventListener('scroll', handleScroll);
|
|
81
|
+
return function () {
|
|
82
|
+
currentRef.removeEventListener('scroll', handleScroll);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}, [handleScroll]);
|
|
86
|
+
var handleMouseEnter = function handleMouseEnter(v, val) {
|
|
87
|
+
setHoveredIndex(val);
|
|
88
|
+
};
|
|
89
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
90
|
+
setHoveredIndex(null);
|
|
91
|
+
};
|
|
92
|
+
var handlePopoverClick = function handlePopoverClick(e) {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
};
|
|
95
|
+
var onRefresh = function onRefresh() {
|
|
96
|
+
dispatch({
|
|
97
|
+
type: 'gimiMenu/updateParams',
|
|
98
|
+
payload: {
|
|
99
|
+
pageIndex: 1
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
dispatch(getChatHistoryList({
|
|
103
|
+
pageIndex: 1,
|
|
104
|
+
pageSize: params.pageSize
|
|
105
|
+
}));
|
|
106
|
+
};
|
|
107
|
+
var handleClickMore = function handleClickMore(e, item) {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
confirm({
|
|
110
|
+
icon: '',
|
|
111
|
+
content: '本条会话记录将被永久删除,不可恢复及撤销。确定要删除吗?',
|
|
112
|
+
title: '永久删除对话',
|
|
113
|
+
okText: '删除',
|
|
114
|
+
cancelText: '取消',
|
|
115
|
+
centered: true,
|
|
116
|
+
closable: true,
|
|
117
|
+
okButtonProps: {
|
|
118
|
+
danger: true
|
|
119
|
+
},
|
|
120
|
+
onOk: function onOk() {
|
|
121
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
122
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
123
|
+
while (1) switch (_context.prev = _context.next) {
|
|
124
|
+
case 0:
|
|
125
|
+
_context.next = 2;
|
|
126
|
+
return handleDelChat(item.id);
|
|
127
|
+
case 2:
|
|
128
|
+
case "end":
|
|
129
|
+
return _context.stop();
|
|
130
|
+
}
|
|
131
|
+
}, _callee);
|
|
132
|
+
}))();
|
|
133
|
+
},
|
|
134
|
+
onCancel: function onCancel() {
|
|
135
|
+
console.log('Cancel');
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
var handleDelChat = /*#__PURE__*/function () {
|
|
140
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id) {
|
|
141
|
+
var res;
|
|
142
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
143
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
144
|
+
case 0:
|
|
145
|
+
_context2.prev = 0;
|
|
146
|
+
_context2.next = 3;
|
|
147
|
+
return deleteConversationById(id);
|
|
148
|
+
case 3:
|
|
149
|
+
res = _context2.sent;
|
|
150
|
+
if (res && res.status == 0) {
|
|
151
|
+
Toast.success('删除成功');
|
|
152
|
+
if (id === conversationId) {
|
|
153
|
+
dispatch({
|
|
154
|
+
type: 'gimiMenu/setConversationId',
|
|
155
|
+
payload: {
|
|
156
|
+
conversationId: ''
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
onRefresh();
|
|
160
|
+
} else {
|
|
161
|
+
onRefresh();
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
Toast.error('删除失败');
|
|
165
|
+
}
|
|
166
|
+
_context2.next = 9;
|
|
167
|
+
break;
|
|
168
|
+
case 7:
|
|
169
|
+
_context2.prev = 7;
|
|
170
|
+
_context2.t0 = _context2["catch"](0);
|
|
171
|
+
case 9:
|
|
172
|
+
case "end":
|
|
173
|
+
return _context2.stop();
|
|
174
|
+
}
|
|
175
|
+
}, _callee2, null, [[0, 7]]);
|
|
176
|
+
}));
|
|
177
|
+
return function handleDelChat(_x) {
|
|
178
|
+
return _ref.apply(this, arguments);
|
|
179
|
+
};
|
|
180
|
+
}();
|
|
181
|
+
var handleClickHistoryItem = function handleClickHistoryItem(item) {
|
|
182
|
+
console.log('handleClickHistoryItem', item.id);
|
|
183
|
+
setHoveredIndex(null);
|
|
184
|
+
dispatch({
|
|
185
|
+
type: 'gimiMenu/setConversationId',
|
|
186
|
+
payload: {
|
|
187
|
+
conversationId: item.id
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
var MoreContent = function MoreContent(_ref2) {
|
|
192
|
+
var v = _ref2.v;
|
|
193
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
194
|
+
onClick: function onClick(e) {
|
|
195
|
+
return handleClickMore(e, v);
|
|
196
|
+
},
|
|
197
|
+
className: styles.morebtn
|
|
198
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
199
|
+
type: 'icon-a-shanchu2x',
|
|
200
|
+
size: 16,
|
|
201
|
+
color: "#FF3636",
|
|
202
|
+
className: styles.iconMore
|
|
203
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
204
|
+
className: styles.deltext
|
|
205
|
+
}, "\u5220\u9664"));
|
|
206
|
+
};
|
|
207
|
+
useEffect(function () {
|
|
208
|
+
if (baseUrl) dispatch(getChatHistoryList({
|
|
209
|
+
pageIndex: 1,
|
|
210
|
+
pageSize: 50
|
|
211
|
+
}));
|
|
212
|
+
}, [baseUrl]);
|
|
213
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
214
|
+
className: styles.history_list,
|
|
215
|
+
style: {
|
|
216
|
+
height: 'calc(100% - 36px)'
|
|
217
|
+
},
|
|
218
|
+
ref: listRef
|
|
219
|
+
}, historyList.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, historyList.map(function (v, index) {
|
|
220
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
221
|
+
className: classNames(styles.history_list_item, _defineProperty({}, styles.menu_active, conversationId == v.id), _defineProperty({}, styles.menu_hover, hoveredIndex === index)),
|
|
222
|
+
key: v.id,
|
|
223
|
+
onClick: function onClick() {
|
|
224
|
+
return handleClickHistoryItem(v);
|
|
225
|
+
},
|
|
226
|
+
onMouseEnter: function onMouseEnter() {
|
|
227
|
+
return handleMouseEnter(v, index);
|
|
228
|
+
},
|
|
229
|
+
onMouseLeave: handleMouseLeave
|
|
230
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
231
|
+
className: styles.history_list_item_text
|
|
232
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
233
|
+
src: hostoryItemIcon,
|
|
234
|
+
width: 18,
|
|
235
|
+
style: {
|
|
236
|
+
margin: '6px 8px 0px'
|
|
237
|
+
},
|
|
238
|
+
alt: ""
|
|
239
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
240
|
+
className: styles.item_text_title
|
|
241
|
+
}, replaceBraces(v.title))), hoveredIndex === index && /*#__PURE__*/React.createElement(Popover, {
|
|
242
|
+
position: "top",
|
|
243
|
+
showArrow: true,
|
|
244
|
+
arrowPointAtCenter: true,
|
|
245
|
+
content: /*#__PURE__*/React.createElement(MoreContent, {
|
|
246
|
+
v: v
|
|
247
|
+
}),
|
|
248
|
+
zIndex: 9,
|
|
249
|
+
trigger: 'click',
|
|
250
|
+
overlayClassName: styles.more_pop
|
|
251
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
252
|
+
className: styles.history_list_item_img,
|
|
253
|
+
onClick: handlePopoverClick
|
|
254
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
255
|
+
src: hoveredIndex === index ? chatlistHover : chatlistIcon,
|
|
256
|
+
alt: "",
|
|
257
|
+
className: styles.iconMore
|
|
258
|
+
}))));
|
|
259
|
+
}), loadingMore && /*#__PURE__*/React.createElement("div", {
|
|
260
|
+
className: styles.loading_more
|
|
261
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
262
|
+
size: "small"
|
|
263
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
264
|
+
style: {
|
|
265
|
+
marginLeft: 8
|
|
266
|
+
}
|
|
267
|
+
}, "\u52A0\u8F7D\u4E2D...")), !hasMore && historyList.length > 10 && /*#__PURE__*/React.createElement("div", {
|
|
268
|
+
className: styles.no_more
|
|
269
|
+
}, "\u6CA1\u6709\u66F4\u591A\u8BB0\u5F55\u4E86")) : loading ? /*#__PURE__*/React.createElement("div", {
|
|
270
|
+
className: styles.loading
|
|
271
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
272
|
+
size: "small"
|
|
273
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
274
|
+
style: {
|
|
275
|
+
marginLeft: 8
|
|
276
|
+
}
|
|
277
|
+
}, "\u52A0\u8F7D\u4E2D...")) : /*#__PURE__*/React.createElement("div", {
|
|
278
|
+
className: styles.empty
|
|
279
|
+
}, "\u6682\u65E0\u6700\u8FD1\u5BF9\u8BDD"));
|
|
280
|
+
};
|
|
281
|
+
export default HistoryList;
|