yt-chat-components 1.1.6 → 1.1.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yt-chat-components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"main": "build/static/js/bundle.min.js",
|
|
5
5
|
"module": "build/static/js/bundle.min.js",
|
|
6
6
|
"types": "build/static/js/index.d.ts",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"echarts": "^5.6.0",
|
|
25
25
|
"echarts-for-react": "^3.0.2",
|
|
26
|
-
"lodash": "^4.17.21",
|
|
27
26
|
"lucide-react": "^0.256.0",
|
|
28
27
|
"react-draggable": "^4.4.6",
|
|
29
28
|
"react": "^17.0.0 || ^18.0.0",
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { MoreHorizontal } from "lucide-react";
|
|
3
|
-
import { ChatMessagePlaceholderType } from "../types/chatWidget";
|
|
4
|
-
// import './index.module.css'
|
|
5
|
-
|
|
6
|
-
export default function ChatMessagePlaceholder({
|
|
7
|
-
bot_message_style,
|
|
8
|
-
}: ChatMessagePlaceholderType) {
|
|
9
|
-
return (
|
|
10
|
-
<div
|
|
11
|
-
className="cl-chat-message cl-justify-start"
|
|
12
|
-
>
|
|
13
|
-
<div style={bot_message_style} className={"cl-bot_message"}>
|
|
14
|
-
<div className="cl-animate-pulse">
|
|
15
|
-
<div className="plh_textBox">
|
|
16
|
-
<div className="plh_text"
|
|
17
|
-
<MoreHorizontal />
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { MoreHorizontal } from "lucide-react";
|
|
3
|
+
import { ChatMessagePlaceholderType } from "../types/chatWidget";
|
|
4
|
+
// import './index.module.css'
|
|
5
|
+
|
|
6
|
+
export default function ChatMessagePlaceholder({
|
|
7
|
+
bot_message_style, aiStatus
|
|
8
|
+
}: ChatMessagePlaceholderType) {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
className="cl-chat-message cl-justify-start"
|
|
12
|
+
>
|
|
13
|
+
<div style={bot_message_style} className={"cl-bot_message"}>
|
|
14
|
+
<div className="cl-animate-pulse">
|
|
15
|
+
<div className="plh_textBox">
|
|
16
|
+
<div className="plh_text">{aiStatus ? aiStatus : "深度思考中"}</div>
|
|
17
|
+
<MoreHorizontal />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -127,7 +127,7 @@ export default function ChatWindow({
|
|
|
127
127
|
}) {
|
|
128
128
|
const ref = useRef<HTMLDivElement>(null);
|
|
129
129
|
const lastMessage = useRef<HTMLDivElement>(null);
|
|
130
|
-
const [
|
|
130
|
+
const [aiStatus, setAiStatus] = useState(null);
|
|
131
131
|
const inputRef = useRef<HTMLInputElement>(null); /* User input Ref */
|
|
132
132
|
/* Initial listener for loss of focus that refocuses User input after a small delay */
|
|
133
133
|
const [nowAIContent, setNowAIContent] = useState<string>('');
|
|
@@ -170,7 +170,7 @@ export default function ChatWindow({
|
|
|
170
170
|
const handleDelayMessage = () => {
|
|
171
171
|
if (delayMessageList.length > 0) {
|
|
172
172
|
const message = delayMessageList.shift();
|
|
173
|
-
console.log("-- add = delay")
|
|
173
|
+
// console.log("-- add = delay")
|
|
174
174
|
addMessage(message);
|
|
175
175
|
handleDelayMessage();
|
|
176
176
|
}
|
|
@@ -220,6 +220,11 @@ export default function ChatWindow({
|
|
|
220
220
|
})
|
|
221
221
|
delayMessageTimer()
|
|
222
222
|
}
|
|
223
|
+
else if (event == 'status') {
|
|
224
|
+
// 更新状态
|
|
225
|
+
console.log("-- status = ", data)
|
|
226
|
+
setAiStatus(data.status)
|
|
227
|
+
}
|
|
223
228
|
else if (event == 'end') {
|
|
224
229
|
const res = {
|
|
225
230
|
data: data['result'],
|
|
@@ -291,6 +296,7 @@ export default function ChatWindow({
|
|
|
291
296
|
contentRef.current = null
|
|
292
297
|
}
|
|
293
298
|
setSendingMessage(false);
|
|
299
|
+
setAiStatus(null)
|
|
294
300
|
}
|
|
295
301
|
};
|
|
296
302
|
|
|
@@ -862,6 +868,9 @@ export default function ChatWindow({
|
|
|
862
868
|
key={index}
|
|
863
869
|
className="w_tagItemBox"
|
|
864
870
|
onClick={() => {
|
|
871
|
+
if (sendingMessage){
|
|
872
|
+
return
|
|
873
|
+
}
|
|
865
874
|
handleSendMessage(item?.name);
|
|
866
875
|
setFileList([]);
|
|
867
876
|
}}
|
|
@@ -1085,7 +1094,7 @@ export default function ChatWindow({
|
|
|
1085
1094
|
message={{ message: nowAIContent}}
|
|
1086
1095
|
isSend={false}
|
|
1087
1096
|
handleSendMessage={handleSendMessage}
|
|
1088
|
-
/> : <ChatMessagePlaceholder bot_message_style={bot_message_style} />
|
|
1097
|
+
/> : <ChatMessagePlaceholder bot_message_style={bot_message_style} aiStatus={aiStatus} />
|
|
1089
1098
|
)
|
|
1090
1099
|
}
|
|
1091
1100
|
<div ref={lastMessage}></div>
|