@rolder/kit 3.0.0-alpha.71 → 3.0.0-alpha.73
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,7 +1,7 @@
|
|
|
1
1
|
import { type StackProps } from '@mantine/core';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
type MessagesProps = Omit<StackProps, 'children'> & {
|
|
4
|
-
children: (
|
|
4
|
+
children: (messageIds: string[]) => ReactNode;
|
|
5
5
|
};
|
|
6
6
|
export declare const Messages: ({ children, ...props }: MessagesProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -5,7 +5,7 @@ const Messages = ({ children, ...props })=>{
|
|
|
5
5
|
const messageIds = useChatMessageIds();
|
|
6
6
|
return /*#__PURE__*/ jsx(Stack, {
|
|
7
7
|
...props,
|
|
8
|
-
children: 'function' == typeof children ? children(messageIds) :
|
|
8
|
+
children: 'function' == typeof children ? children(messageIds) : null
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
export { Messages };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { UseChatOptions } from '@ai-sdk/react';
|
|
2
|
-
import { type PaperProps } from '@mantine/core';
|
|
2
|
+
import { type PaperProps, type StackProps } from '@mantine/core';
|
|
3
3
|
import type { ChatInit, UIMessage } from 'ai';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
4
5
|
import { type ScrollAreaProps } from '../../../ui';
|
|
5
6
|
export interface ConversationRootProps extends PaperProps {
|
|
6
|
-
children
|
|
7
|
+
children: (messageIds: string[]) => ReactNode;
|
|
7
8
|
scrollAreaProps?: ScrollAreaProps;
|
|
8
9
|
withScrollButton?: boolean;
|
|
10
|
+
stackProps?: StackProps;
|
|
9
11
|
chatOptions?: UseChatOptions<UIMessage> & ChatInit<UIMessage>;
|
|
10
12
|
}
|
|
11
|
-
export declare const Root: ({ children, scrollAreaProps, withScrollButton, chatOptions, ...props }: ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Root: ({ children, scrollAreaProps, withScrollButton, stackProps, chatOptions, ...props }: ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/ai/ui/chat/Root.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Paper } from "@mantine/core";
|
|
2
|
+
import { Paper, Stack } from "@mantine/core";
|
|
3
3
|
import { ScrollArea } from "../../../ui/index.js";
|
|
4
|
-
import { useInitChat } from "./store/index.js";
|
|
4
|
+
import { useChatMessageIds, useInitChat } from "./store/index.js";
|
|
5
5
|
const ChatInitializer = ({ chatOptions })=>{
|
|
6
6
|
useInitChat(chatOptions);
|
|
7
7
|
return null;
|
|
8
8
|
};
|
|
9
|
-
const Root = ({ children, scrollAreaProps, withScrollButton = true, chatOptions, ...props })
|
|
9
|
+
const Root = ({ children, scrollAreaProps, withScrollButton = true, stackProps, chatOptions, ...props })=>{
|
|
10
|
+
const messageIds = useChatMessageIds();
|
|
11
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
10
12
|
children: [
|
|
11
13
|
/*#__PURE__*/ jsx(ChatInitializer, {
|
|
12
14
|
chatOptions: chatOptions
|
|
@@ -21,11 +23,15 @@ const Root = ({ children, scrollAreaProps, withScrollButton = true, chatOptions,
|
|
|
21
23
|
p: "md",
|
|
22
24
|
...scrollAreaProps,
|
|
23
25
|
children: [
|
|
24
|
-
|
|
26
|
+
/*#__PURE__*/ jsx(Stack, {
|
|
27
|
+
...stackProps,
|
|
28
|
+
children: 'function' == typeof children ? children(messageIds) : null
|
|
29
|
+
}),
|
|
25
30
|
withScrollButton && /*#__PURE__*/ jsx(ScrollArea.ScrollButton, {})
|
|
26
31
|
]
|
|
27
32
|
})
|
|
28
33
|
})
|
|
29
34
|
]
|
|
30
35
|
});
|
|
36
|
+
};
|
|
31
37
|
export { Root };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const Chat: {
|
|
2
|
-
Root: ({ children, scrollAreaProps, withScrollButton, chatOptions, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
Root: ({ children, scrollAreaProps, withScrollButton, stackProps, chatOptions, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
Messages: ({ children, ...props }: Omit<import("@mantine/core").StackProps, "children"> & {
|
|
4
|
-
children: (
|
|
4
|
+
children: (messageIds: string[]) => import("react").ReactNode;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
Message: import("react").MemoExoticComponent<({ messageId }: {
|
|
7
7
|
messageId: string;
|