@rolder/kit 3.0.0-alpha.53 → 3.0.0-alpha.55
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Loader } from "@mantine/core";
|
|
3
|
-
import { useIsLoading } from "./store/index.js";
|
|
3
|
+
import { useIsLoading, useIsStreaming } from "./store/index.js";
|
|
4
4
|
const Loader_Loader = (props)=>{
|
|
5
5
|
const isLoading = useIsLoading();
|
|
6
|
+
const isStreaming = useIsStreaming();
|
|
6
7
|
console.log('Loader render', isLoading);
|
|
7
|
-
return isLoading ? /*#__PURE__*/ jsx(Loader, {
|
|
8
|
+
return isLoading && !isStreaming ? /*#__PURE__*/ jsx(Loader, {
|
|
8
9
|
size: 28,
|
|
9
10
|
type: "dots",
|
|
10
11
|
...props
|
|
@@ -21,25 +21,18 @@ const addChatMessage = (newMessage)=>{
|
|
|
21
21
|
const setChatMessages = (messages)=>{
|
|
22
22
|
const newIds = messages.map((msg)=>msg.id);
|
|
23
23
|
$chatMessageIds.set(newIds);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
isChanged = true;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (isChanged) $chatMessages.setKey(lastNewMessage.id, lastNewMessage);
|
|
41
|
-
}
|
|
42
|
-
} else $chatMessages.setKey(lastNewMessage.id, lastNewMessage);
|
|
24
|
+
const currentMessages = $chatMessages.get();
|
|
25
|
+
const lastMessage = messages[messages.length - 1];
|
|
26
|
+
for(let i = 0; i < messages.length; i++){
|
|
27
|
+
const msg = messages[i];
|
|
28
|
+
const currentMsg = currentMessages[msg.id];
|
|
29
|
+
const isLastMessage = msg === lastMessage;
|
|
30
|
+
if (currentMsg) if (isLastMessage) $chatMessages.setKey(msg.id, msg);
|
|
31
|
+
else {
|
|
32
|
+
const isChanged = JSON.stringify(currentMsg) !== JSON.stringify(msg);
|
|
33
|
+
if (isChanged) $chatMessages.setKey(msg.id, msg);
|
|
34
|
+
}
|
|
35
|
+
else $chatMessages.setKey(msg.id, msg);
|
|
43
36
|
}
|
|
44
37
|
};
|
|
45
38
|
const $isEmpty = computed($chatMessageIds, (messages)=>0 === messages.length);
|