@rolder/kit 3.0.0-alpha.64 → 3.0.0-alpha.67
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/dist/ai/ui/chat/Message.d.ts +2 -6
- package/dist/ai/ui/chat/Message.js +14 -22
- package/dist/ai/ui/chat/Messages.d.ts +6 -2
- package/dist/ai/ui/chat/Messages.js +15 -5
- package/dist/ai/ui/chat/Root.d.ts +1 -4
- package/dist/ai/ui/chat/Root.js +2 -12
- package/dist/ai/ui/chat/index.d.ts +7 -4
- package/dist/ai/ui/chat/index.js +3 -1
- package/package.json +1 -1
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
type MessageProps = {
|
|
1
|
+
export declare const Message: import("react").MemoExoticComponent<({ messageId }: {
|
|
3
2
|
messageId: string;
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export declare const Message: import("react").MemoExoticComponent<({ messageId, loaderProps }: MessageProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
7
|
-
export {};
|
|
3
|
+
}) => import("react/jsx-runtime").JSX.Element | null>;
|
|
@@ -1,32 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Paper } from "@mantine/core";
|
|
3
3
|
import { memo } from "react";
|
|
4
4
|
import { Streamdown } from "streamdown";
|
|
5
|
-
import { Loader } from "./Loader.js";
|
|
6
5
|
import { getIsStreaming, useChatMessage, useChatMessagePart } from "./store/index.js";
|
|
7
|
-
const Message = /*#__PURE__*/ memo(({ messageId
|
|
6
|
+
const Message = /*#__PURE__*/ memo(({ messageId })=>{
|
|
8
7
|
const message = useChatMessage(messageId);
|
|
9
8
|
const part = useChatMessagePart(messageId, 'text');
|
|
10
9
|
console.log(messageId);
|
|
11
|
-
return part ? /*#__PURE__*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
children: part?.text
|
|
24
|
-
})
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ jsx(Loader, {
|
|
27
|
-
...loaderProps
|
|
28
|
-
})
|
|
29
|
-
]
|
|
10
|
+
return part ? /*#__PURE__*/ jsx(Paper, {
|
|
11
|
+
radius: "md",
|
|
12
|
+
px: "md",
|
|
13
|
+
py: "sm",
|
|
14
|
+
maw: "80%",
|
|
15
|
+
ml: 'user' === message.role ? 'auto' : void 0,
|
|
16
|
+
bg: 'user' === message.role ? 'var(--mantine-color-default-hover)' : 'var(--mantine-primary-color-light)',
|
|
17
|
+
fz: "sm",
|
|
18
|
+
children: /*#__PURE__*/ jsx(Streamdown, {
|
|
19
|
+
isAnimating: getIsStreaming() && 'assistant' === message.role,
|
|
20
|
+
children: part?.text
|
|
21
|
+
})
|
|
30
22
|
}) : null;
|
|
31
23
|
});
|
|
32
24
|
export { Message };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type StackProps } from '@mantine/core';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
type
|
|
3
|
+
import { type ScrollAreaProps } from '../../../ui';
|
|
4
|
+
type MessagesProps = {
|
|
4
5
|
children: (messageId: string) => ReactNode;
|
|
6
|
+
scrollAreaProps?: ScrollAreaProps;
|
|
7
|
+
withScrollButton?: boolean;
|
|
8
|
+
stackProps?: StackProps;
|
|
5
9
|
};
|
|
6
|
-
export declare const Messages: ({ children,
|
|
10
|
+
export declare const Messages: ({ children, scrollAreaProps, withScrollButton, stackProps, }: MessagesProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
export {};
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Stack } from "@mantine/core";
|
|
3
|
+
import { ScrollArea } from "../../../ui/index.js";
|
|
3
4
|
import { useChatMessageIds } from "./store/index.js";
|
|
4
|
-
const Messages = ({ children,
|
|
5
|
+
const Messages = ({ children, scrollAreaProps, withScrollButton = true, stackProps })=>{
|
|
5
6
|
const messageIds = useChatMessageIds();
|
|
6
|
-
return /*#__PURE__*/
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
return /*#__PURE__*/ jsxs(ScrollArea, {
|
|
8
|
+
autoScroll: true,
|
|
9
|
+
scrollToBottomOnInit: true,
|
|
10
|
+
p: "md",
|
|
11
|
+
...scrollAreaProps,
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsx(Stack, {
|
|
14
|
+
...stackProps,
|
|
15
|
+
children: 'function' == typeof children ? messageIds.map((messageId)=>children(messageId)) : null
|
|
16
|
+
}),
|
|
17
|
+
withScrollButton && /*#__PURE__*/ jsx(ScrollArea.ScrollButton, {})
|
|
18
|
+
]
|
|
9
19
|
});
|
|
10
20
|
};
|
|
11
21
|
export { Messages };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { UseChatOptions } from '@ai-sdk/react';
|
|
2
2
|
import { type PaperProps } from '@mantine/core';
|
|
3
3
|
import type { ChatInit, UIMessage } from 'ai';
|
|
4
|
-
import { type ScrollAreaProps } from '../../../ui';
|
|
5
4
|
export interface ConversationRootProps extends PaperProps {
|
|
6
5
|
children?: React.ReactNode;
|
|
7
|
-
scrollAreaProps?: ScrollAreaProps;
|
|
8
|
-
withScrollButton?: boolean;
|
|
9
6
|
chatOptions?: UseChatOptions<UIMessage> & ChatInit<UIMessage>;
|
|
10
7
|
}
|
|
11
|
-
export declare const Root: ({ children,
|
|
8
|
+
export declare const Root: ({ children, chatOptions, ...props }: ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/ai/ui/chat/Root.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Paper } from "@mantine/core";
|
|
3
|
-
import { ScrollArea } from "../../../ui/index.js";
|
|
4
3
|
import { useInitChat } from "./store/index.js";
|
|
5
4
|
const ChatInitializer = ({ chatOptions })=>{
|
|
6
5
|
useInitChat(chatOptions);
|
|
7
6
|
return null;
|
|
8
7
|
};
|
|
9
|
-
const Root = ({ children,
|
|
8
|
+
const Root = ({ children, chatOptions, ...props })=>/*#__PURE__*/ jsxs(Fragment, {
|
|
10
9
|
children: [
|
|
11
10
|
/*#__PURE__*/ jsx(ChatInitializer, {
|
|
12
11
|
chatOptions: chatOptions
|
|
@@ -15,16 +14,7 @@ const Root = ({ children, scrollAreaProps, withScrollButton = true, chatOptions,
|
|
|
15
14
|
withBorder: true,
|
|
16
15
|
radius: "md",
|
|
17
16
|
...props,
|
|
18
|
-
children:
|
|
19
|
-
autoScroll: true,
|
|
20
|
-
scrollToBottomOnInit: true,
|
|
21
|
-
p: "md",
|
|
22
|
-
...scrollAreaProps,
|
|
23
|
-
children: [
|
|
24
|
-
children,
|
|
25
|
-
withScrollButton && /*#__PURE__*/ jsx(ScrollArea.ScrollButton, {})
|
|
26
|
-
]
|
|
27
|
-
})
|
|
17
|
+
children: children
|
|
28
18
|
})
|
|
29
19
|
]
|
|
30
20
|
});
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
export declare const Chat: {
|
|
2
|
-
Root: ({ children,
|
|
3
|
-
Messages: ({ children,
|
|
2
|
+
Root: ({ children, chatOptions, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Messages: ({ children, scrollAreaProps, withScrollButton, stackProps, }: {
|
|
4
4
|
children: (messageId: string) => import("react").ReactNode;
|
|
5
|
+
scrollAreaProps?: import("../../..").ScrollAreaProps;
|
|
6
|
+
withScrollButton?: boolean;
|
|
7
|
+
stackProps?: import("@mantine/core").StackProps;
|
|
5
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
Message: import("react").MemoExoticComponent<({ messageId
|
|
9
|
+
Message: import("react").MemoExoticComponent<({ messageId }: {
|
|
7
10
|
messageId: string;
|
|
8
|
-
loaderProps?: import("@mantine/core").LoaderProps;
|
|
9
11
|
}) => import("react/jsx-runtime").JSX.Element | null>;
|
|
10
12
|
File: ({ messageId }: {
|
|
11
13
|
messageId: string;
|
|
12
14
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
15
|
Empty: () => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
Loader: (props: import("@mantine/core").LoaderProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
14
17
|
};
|
|
15
18
|
export { ChatInput } from './chatInput';
|
|
16
19
|
export * from './store';
|
package/dist/ai/ui/chat/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Empty } from "./Empty.js";
|
|
2
2
|
import { File } from "./File.js";
|
|
3
|
+
import { Loader } from "./Loader.js";
|
|
3
4
|
import { Message } from "./Message.js";
|
|
4
5
|
import { Messages } from "./Messages.js";
|
|
5
6
|
import { Root } from "./Root.js";
|
|
@@ -10,6 +11,7 @@ const Chat = {
|
|
|
10
11
|
Messages: Messages,
|
|
11
12
|
Message: Message,
|
|
12
13
|
File: File,
|
|
13
|
-
Empty: Empty
|
|
14
|
+
Empty: Empty,
|
|
15
|
+
Loader: Loader
|
|
14
16
|
};
|
|
15
17
|
export { Chat, ChatInput };
|