yt-chat-components 0.9.8 → 0.9.9-a
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/.idea/sonarlint/issuestore/index.pb +1 -5
- package/package.json +1 -1
- package/src/YtChatView/chatWidget/chatWindow/index.tsx +18 -3
- package/.idea/sonarlint/issuestore/2/e/2e9f70bf32b414323ca1647e2b6f26e1533ee2fc +0 -0
- package/.idea/sonarlint/issuestore/5/a/5ab44fe33ca96299f51ad4778a73e425b92bf439 +0 -0
|
@@ -19,8 +19,6 @@ H
|
|
|
19
19
|
src/chatWidget/index.tsx,3/6/364385cedcce4c06de1901392ffeeac0caef0f3c
|
|
20
20
|
=
|
|
21
21
|
|
|
22
|
-
j
|
|
23
|
-
:src/YtChatView/chatWidget/chatWindow/chatMessage/index.tsx,2/e/2e9f70bf32b414323ca1647e2b6f26e1533ee2fc
|
|
24
22
|
e
|
|
25
23
|
5src/YtChatView/chatWidget/chatWindow/index.module.css,d/7/d747cbed4201192dfa83a1a51345b020a050b647
|
|
26
24
|
U
|
|
@@ -34,6 +32,4 @@ U
|
|
|
34
32
|
A
|
|
35
33
|
webpack.config.js,d/5/d5595158cc48f9bf3e51b06f6e6805a8fd2d6262
|
|
36
34
|
S
|
|
37
|
-
#src/chatWidget/chatWindow/index.tsx,6/c/6c024c1d0ad64656b9d4b0695ec3c49c0454addf
|
|
38
|
-
=
|
|
39
|
-
|
|
35
|
+
#src/chatWidget/chatWindow/index.tsx,6/c/6c024c1d0ad64656b9d4b0695ec3c49c0454addf
|
package/package.json
CHANGED
|
@@ -135,6 +135,7 @@ export default function ChatWindow({
|
|
|
135
135
|
const {isTitleSideIcon, logoWidth, agentUrl} = baseConfig;
|
|
136
136
|
const inputContainerRef = useRef(null);
|
|
137
137
|
const [inputContainerHeight,setInputContainerHeight] = useState('50px')
|
|
138
|
+
const contentRef = useRef(nowAIContent);
|
|
138
139
|
|
|
139
140
|
let voiceChunks = []; // 临时存储录制的语音片段
|
|
140
141
|
// 滚动事件处理,选择文件时,文件内容超出显示框时,显示左右箭头
|
|
@@ -155,16 +156,21 @@ export default function ChatWindow({
|
|
|
155
156
|
|
|
156
157
|
// 流式输出消息,实时显示(token为流式输出内容,end为结束输出,整体输出一次)
|
|
157
158
|
const handleMessageContent = (event, data) => {
|
|
159
|
+
// console.error("event, data",event, data)
|
|
158
160
|
if (event == 'add_message' && data['sender'] == 'Machine') {
|
|
159
161
|
getHistoryList();
|
|
160
162
|
} else if (event == 'token') {
|
|
161
|
-
setNowAIContent((prevState) =>
|
|
163
|
+
setNowAIContent((prevState) => {
|
|
164
|
+
const newValue = prevState + data['chunk'];
|
|
165
|
+
contentRef.current = newValue
|
|
166
|
+
return newValue
|
|
167
|
+
});
|
|
162
168
|
if (lastMessage.current) lastMessage.current.scrollIntoView({ behavior: 'smooth' });
|
|
163
|
-
} else if (
|
|
169
|
+
} else if (event == 'end') {
|
|
164
170
|
const res = {
|
|
165
171
|
data: data['result'],
|
|
166
172
|
};
|
|
167
|
-
if (
|
|
173
|
+
if (false&&
|
|
168
174
|
res.data &&
|
|
169
175
|
res.data.outputs &&
|
|
170
176
|
Object.keys(res.data.outputs).length > 0 &&
|
|
@@ -217,6 +223,15 @@ export default function ChatWindow({
|
|
|
217
223
|
});
|
|
218
224
|
}
|
|
219
225
|
}
|
|
226
|
+
const output = {
|
|
227
|
+
message:contentRef.current,
|
|
228
|
+
type:'text'
|
|
229
|
+
};
|
|
230
|
+
addMessage({
|
|
231
|
+
message: extractMessageFromOutput(output),
|
|
232
|
+
isSend: false,
|
|
233
|
+
rawInfo: output.message,
|
|
234
|
+
});
|
|
220
235
|
setSendingMessage(false);
|
|
221
236
|
}
|
|
222
237
|
};
|
|
File without changes
|
|
File without changes
|