@myun/gimi-chat 0.3.9 → 0.4.1
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/components/chat-input/index.d.ts +6 -0
- package/dist/components/chat-input/index.js +4 -2
- package/dist/components/chat-input/index.module.css +5 -3
- package/dist/components/message-list/index.module.css +1 -1
- package/dist/components/preset-agent-content/index.module.css +1 -1
- package/dist/components/quoted-content/index.d.ts +8 -1
- package/dist/components/quoted-content/index.js +31 -3
- package/dist/components/quoted-content/index.module.css +59 -10
- package/dist/components/templates/CommonChat.js +4 -2
- package/dist/hooks/useChatHistory.js +2 -2
- package/dist/types/chat.d.ts +1 -0
- package/dist/umd/index.min.js +1 -1
- package/package.json +1 -1
|
@@ -32,6 +32,12 @@ interface IAIInputProps {
|
|
|
32
32
|
showDefaultPrompt?: boolean;
|
|
33
33
|
onConversationCreated?: (conversationId: number) => void;
|
|
34
34
|
onMicHangUp?: () => void;
|
|
35
|
+
initQuoteSource?: {
|
|
36
|
+
teachModelId: number;
|
|
37
|
+
teachModelName: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
duration: number;
|
|
40
|
+
};
|
|
35
41
|
}
|
|
36
42
|
declare const ChatInput: React.ForwardRefExoticComponent<IAIInputProps & React.RefAttributes<ChatInputRef>>;
|
|
37
43
|
export default ChatInput;
|
|
@@ -300,8 +300,10 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
300
300
|
if (!props.enableSourceQuote) {
|
|
301
301
|
return null;
|
|
302
302
|
}
|
|
303
|
-
return /*#__PURE__*/React.createElement(QuotedContent,
|
|
304
|
-
|
|
303
|
+
return /*#__PURE__*/React.createElement(QuotedContent, {
|
|
304
|
+
initQuoteSource: props.initQuoteSource
|
|
305
|
+
});
|
|
306
|
+
}, [props.enableSourceQuote, props.initQuoteSource]);
|
|
305
307
|
var renderActionArea = React.useCallback(function (renderProps) {
|
|
306
308
|
return /*#__PURE__*/React.createElement("div", {
|
|
307
309
|
className: renderProps.className,
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
-
width: 100
|
|
5
|
+
width: calc(100% - 32px);
|
|
6
|
+
max-width: 800px;
|
|
7
|
+
margin: 0px 16px 10px 16px;
|
|
8
|
+
box-shadow: inset 0 2px #fff, 0 2px 10px rgba(84, 105, 140, 0.15);
|
|
9
|
+
border-radius: 10px;
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
.deepthink {
|
|
@@ -44,8 +48,6 @@
|
|
|
44
48
|
|
|
45
49
|
.chatInput {
|
|
46
50
|
width: 100%;
|
|
47
|
-
box-shadow: inset 0 2px #fff, 0 2px 10px rgba(84, 105, 140, 0.15);
|
|
48
|
-
margin: 0px 10px 10px 10px;
|
|
49
51
|
padding: 16px;
|
|
50
52
|
max-width: 800px;
|
|
51
53
|
max-height: 400px;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const QuotedContent: React.FC
|
|
2
|
+
declare const QuotedContent: React.FC<{
|
|
3
|
+
initQuoteSource?: {
|
|
4
|
+
teachModelId: number;
|
|
5
|
+
teachModelName: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
duration: number;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
3
10
|
export default QuotedContent;
|
|
@@ -14,7 +14,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
14
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
15
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
import { Input, Toast, Table, Popover, Tooltip } from '@douyinfe/semi-ui';
|
|
17
|
+
import { Input, Toast, Table, Popover, Tooltip, Divider } from '@douyinfe/semi-ui';
|
|
18
18
|
import styles from "./index.module.css";
|
|
19
19
|
import { useCallback, useRef, useState } from 'react';
|
|
20
20
|
import IconFontCom from "../iconfont-com";
|
|
@@ -24,6 +24,7 @@ import { useAppSelector, useAppDispatch } from "../../store/hooks";
|
|
|
24
24
|
import { setQuoteProductList, setQuoteTeachModelList } from "../../store/slices/gimiMenuSlice";
|
|
25
25
|
import { throttle } from 'lodash';
|
|
26
26
|
import React from 'react';
|
|
27
|
+
import classNames from 'classnames';
|
|
27
28
|
var DEBOUNCE_MS = 600; // 拉长到 600 ms
|
|
28
29
|
|
|
29
30
|
var tabList = [{
|
|
@@ -34,7 +35,8 @@ var tabList = [{
|
|
|
34
35
|
];
|
|
35
36
|
var quotoIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/30/be6d9_20260130135139.png';
|
|
36
37
|
var isActiveQuotoIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/30/8e64c_20260130135037.png';
|
|
37
|
-
var QuotedContent = function QuotedContent() {
|
|
38
|
+
var QuotedContent = function QuotedContent(_ref) {
|
|
39
|
+
var initQuoteSource = _ref.initQuoteSource;
|
|
38
40
|
var _useState = useState('video'),
|
|
39
41
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
42
|
activeKey = _useState2[0],
|
|
@@ -184,6 +186,14 @@ var QuotedContent = function QuotedContent() {
|
|
|
184
186
|
}
|
|
185
187
|
handleClose();
|
|
186
188
|
};
|
|
189
|
+
var handleCurrentVideoClick = function handleCurrentVideoClick() {
|
|
190
|
+
var record = {
|
|
191
|
+
id: initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.teachModelId,
|
|
192
|
+
name: initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.teachModelName,
|
|
193
|
+
duration: initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.duration
|
|
194
|
+
};
|
|
195
|
+
handleSelect(record);
|
|
196
|
+
};
|
|
187
197
|
|
|
188
198
|
// 滚动加载更多
|
|
189
199
|
var throttledScroll = useCallback(throttle(function (scrollTop, scrollHeight, clientHeight) {
|
|
@@ -232,12 +242,30 @@ var QuotedContent = function QuotedContent() {
|
|
|
232
242
|
className: styles.newtab
|
|
233
243
|
}, tabList.map(function (tab) {
|
|
234
244
|
return /*#__PURE__*/React.createElement("span", {
|
|
235
|
-
className:
|
|
245
|
+
className: classNames(styles.tabItem, tab.key === activeKey ? styles.active : ''),
|
|
236
246
|
key: tab.key,
|
|
237
247
|
onClick: function onClick() {
|
|
238
248
|
return handleTabChange(tab.key);
|
|
239
249
|
}
|
|
240
250
|
}, tab.displayName);
|
|
251
|
+
})), initQuoteSource && /*#__PURE__*/React.createElement("div", {
|
|
252
|
+
className: styles.current_video
|
|
253
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
254
|
+
className: styles.text
|
|
255
|
+
}, "\u5F53\u524D\u89C6\u9891"), /*#__PURE__*/React.createElement("span", {
|
|
256
|
+
className: styles.currentItem,
|
|
257
|
+
onClick: handleCurrentVideoClick
|
|
258
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
259
|
+
alt: "\u8D44\u6599\u5F15\u7528\u56FE\u7247",
|
|
260
|
+
className: styles.img,
|
|
261
|
+
src: knowledgeConstants.VIDEO_ICON_ADDRESS
|
|
262
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
263
|
+
className: styles.name,
|
|
264
|
+
title: initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.teachModelName
|
|
265
|
+
}, initQuoteSource === null || initQuoteSource === void 0 ? void 0 : initQuoteSource.teachModelName)), /*#__PURE__*/React.createElement(Divider, {
|
|
266
|
+
style: {
|
|
267
|
+
margin: '0px 5px'
|
|
268
|
+
}
|
|
241
269
|
})), /*#__PURE__*/React.createElement("div", {
|
|
242
270
|
className: styles.tabContent,
|
|
243
271
|
ref: tabContentRef,
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
font-size: 12px;
|
|
14
14
|
padding: 0 10px;
|
|
15
15
|
border-radius: 8px;
|
|
16
|
-
|
|
16
|
+
margin-left: 5px;
|
|
17
|
+
width: calc(100% - 10px);
|
|
17
18
|
}
|
|
18
19
|
.searchInput input::placeholder {
|
|
19
20
|
color: #7d91b3;
|
|
@@ -26,14 +27,14 @@
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
.newtab {
|
|
30
|
+
padding-left: 5px;
|
|
29
31
|
padding-bottom: 10px;
|
|
30
32
|
width: 100%;
|
|
31
33
|
display: flex;
|
|
32
34
|
flex-wrap: nowrap;
|
|
33
35
|
overflow-x: auto;
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
.tabItem {
|
|
37
|
+
.newtab .tabItem {
|
|
37
38
|
font-size: 14px;
|
|
38
39
|
padding: 5px 10px;
|
|
39
40
|
margin-right: 16px;
|
|
@@ -41,12 +42,11 @@
|
|
|
41
42
|
cursor: pointer;
|
|
42
43
|
flex-shrink: 0;
|
|
43
44
|
}
|
|
44
|
-
.tabItem:hover {
|
|
45
|
+
.newtab .tabItem:hover {
|
|
45
46
|
background-color: #f7f7fc;
|
|
46
47
|
color: #4086ff;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
.active {
|
|
49
|
+
.newtab .active {
|
|
50
50
|
background-color: #f7f7fc;
|
|
51
51
|
color: #4086ff;
|
|
52
52
|
font-weight: 600;
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
.tabContent .table :global(.semi-table-row-cell) {
|
|
65
65
|
font-size: 12px;
|
|
66
66
|
border: none !important;
|
|
67
|
-
padding:
|
|
67
|
+
padding: 0 !important;
|
|
68
68
|
overflow: hidden;
|
|
69
69
|
text-overflow: ellipsis;
|
|
70
70
|
white-space: nowrap;
|
|
@@ -73,20 +73,27 @@
|
|
|
73
73
|
.tabContent .table :global(.semi-table-tbody .semi-table-row) {
|
|
74
74
|
width: 100%;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
.listItem {
|
|
77
78
|
display: flex;
|
|
78
79
|
align-items: center;
|
|
79
80
|
cursor: pointer;
|
|
80
81
|
width: 100%;
|
|
81
82
|
overflow: hidden;
|
|
82
83
|
min-width: 0;
|
|
84
|
+
font-size: 12px;
|
|
85
|
+
padding: 8px;
|
|
83
86
|
}
|
|
84
|
-
.
|
|
87
|
+
.listItem:hover {
|
|
88
|
+
background-color: #f7f7fc;
|
|
89
|
+
color: #4086ff;
|
|
90
|
+
}
|
|
91
|
+
.listItem .img {
|
|
85
92
|
width: 16px;
|
|
86
93
|
margin-right: 8px;
|
|
87
94
|
flex-shrink: 0;
|
|
88
95
|
}
|
|
89
|
-
.
|
|
96
|
+
.listItem .text {
|
|
90
97
|
flex: 1;
|
|
91
98
|
overflow: hidden;
|
|
92
99
|
text-overflow: ellipsis;
|
|
@@ -129,4 +136,46 @@
|
|
|
129
136
|
.isActive {
|
|
130
137
|
background-color: #f2f3f7;
|
|
131
138
|
border-radius: 8px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.current_video {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
padding-top: 5px;
|
|
145
|
+
}
|
|
146
|
+
.current_video .text {
|
|
147
|
+
font-family: PingFang SC;
|
|
148
|
+
font-weight: 400;
|
|
149
|
+
font-style: Regular;
|
|
150
|
+
font-size: 12px;
|
|
151
|
+
line-height: 150%;
|
|
152
|
+
letter-spacing: 0px;
|
|
153
|
+
color: rgb(154, 167, 183);
|
|
154
|
+
padding-left: 5px;
|
|
155
|
+
}
|
|
156
|
+
.current_video .currentItem {
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
width: 100%;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
min-width: 0;
|
|
163
|
+
font-size: 12px;
|
|
164
|
+
padding: 8px;
|
|
165
|
+
}
|
|
166
|
+
.current_video .currentItem:hover {
|
|
167
|
+
background-color: #f7f7fc;
|
|
168
|
+
color: #4086ff;
|
|
169
|
+
}
|
|
170
|
+
.current_video .currentItem .img {
|
|
171
|
+
width: 16px;
|
|
172
|
+
margin-right: 8px;
|
|
173
|
+
flex-shrink: 0;
|
|
174
|
+
}
|
|
175
|
+
.current_video .currentItem .name {
|
|
176
|
+
flex: 1;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
text-overflow: ellipsis;
|
|
179
|
+
white-space: nowrap;
|
|
180
|
+
min-width: 0;
|
|
132
181
|
}
|
|
@@ -100,7 +100,8 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
100
100
|
messageList: messageList,
|
|
101
101
|
agentDetail: agentObj,
|
|
102
102
|
conversationId: store.getState().gimiMenu.conversationId,
|
|
103
|
-
inputEditor: chatInputRef.current
|
|
103
|
+
inputEditor: chatInputRef.current,
|
|
104
|
+
uploadFileList: store.getState().gimiMenu.fileList
|
|
104
105
|
};
|
|
105
106
|
});
|
|
106
107
|
React.useEffect(function () {
|
|
@@ -224,7 +225,8 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
224
225
|
shortAsrClick: shortAsrClick,
|
|
225
226
|
disableVoiceCommunication: disableVoiceCommunication,
|
|
226
227
|
onHistoryReload: onHistoryReload,
|
|
227
|
-
platform: platform
|
|
228
|
+
platform: platform,
|
|
229
|
+
initQuoteSource: props.initQuoteSource
|
|
228
230
|
}, chatInputConfig)), showPrologue && messageList.length === 0 && !isMoreLoading && quickQuestionListPosition === 'bottom' && /*#__PURE__*/React.createElement(PresetAgentContent, {
|
|
229
231
|
prologue: '',
|
|
230
232
|
questionList: (agentObj === null || agentObj === void 0 ? void 0 : agentObj.questionList) || [],
|
|
@@ -77,7 +77,7 @@ var useChatHistory = function useChatHistory(checkUnfinishedMessage, scrollBotto
|
|
|
77
77
|
|
|
78
78
|
// 处理加载历史后的滚动补偿
|
|
79
79
|
useLayoutEffect(function () {
|
|
80
|
-
if (historyScrollRef.current && containerRef.current) {
|
|
80
|
+
if (historyScrollRef.current && containerRef.current && !isMoreLoading) {
|
|
81
81
|
var _historyScrollRef$cur = historyScrollRef.current,
|
|
82
82
|
height = _historyScrollRef$cur.height,
|
|
83
83
|
top = _historyScrollRef$cur.top;
|
|
@@ -94,7 +94,7 @@ var useChatHistory = function useChatHistory(checkUnfinishedMessage, scrollBotto
|
|
|
94
94
|
}
|
|
95
95
|
historyScrollRef.current = null;
|
|
96
96
|
}
|
|
97
|
-
}, [messageList]);
|
|
97
|
+
}, [messageList, isMoreLoading, containerRef]);
|
|
98
98
|
|
|
99
99
|
// 处理滚动事件
|
|
100
100
|
useEffect(function () {
|