@rolder/kit 3.0.0-alpha.45 → 3.0.0-alpha.47

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.
@@ -7,10 +7,7 @@ const Message = /*#__PURE__*/ memo(({ messageId })=>{
7
7
  const message = useChatMessage(messageId);
8
8
  const part = useChatMessagePart(messageId, 'text');
9
9
  const isStreaming = useIsStreaming();
10
- console.log('Message render', {
11
- message,
12
- part
13
- });
10
+ console.log('Message render', part?.text);
14
11
  return part ? /*#__PURE__*/ jsx(Paper, {
15
12
  radius: "md",
16
13
  px: "md",
@@ -68,10 +68,6 @@ ${fileContent}
68
68
  } catch (error) {
69
69
  fileErrorNotificaton(error);
70
70
  }
71
- console.log('onSubmit', onSubmit, {
72
- text,
73
- file
74
- });
75
71
  if (onSubmit) onSubmit({
76
72
  text,
77
73
  file: fileUIPart
@@ -1,10 +1,14 @@
1
1
  import { useChat } from "@ai-sdk/react";
2
2
  import { notifications } from "@mantine/notifications";
3
3
  import { useStore } from "@nanostores/react";
4
- import { atom, computed, map } from "nanostores";
4
+ import { atom, computed, map, onSet } from "nanostores";
5
5
  import { useEffect } from "react";
6
6
  import { setChatError, setChatStatus } from "./states.js";
7
7
  const $chatMessageIds = atom([]);
8
+ onSet($chatMessageIds, ({ newValue, abort })=>{
9
+ const currentValue = $chatMessageIds.get();
10
+ if (currentValue.length === newValue.length && currentValue.every((id, index)=>id === newValue[index])) abort();
11
+ });
8
12
  const $chatMessages = map({});
9
13
  const getChatMessage = (messageId)=>$chatMessages.get()[messageId];
10
14
  const addChatMessage = (newMessage)=>{
@@ -68,7 +72,6 @@ const useChatMessage = (messageId)=>useStore($chatMessages, {
68
72
  })[messageId];
69
73
  const useChatMessagePart = (messageId, type)=>{
70
74
  const message = useChatMessage(messageId);
71
- console.log(messageId, message);
72
75
  const part = message?.parts?.find((i)=>i.type === type);
73
76
  return part;
74
77
  };
@@ -79,7 +82,6 @@ const messages_sendMessage = async ({ text, file }, data)=>{
79
82
  const files = file ? [
80
83
  file
81
84
  ] : [];
82
- console.log(getChatSendMessage());
83
85
  await getChatSendMessage()?.({
84
86
  text,
85
87
  files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolder/kit",
3
- "version": "3.0.0-alpha.45",
3
+ "version": "3.0.0-alpha.47",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {