@rolder/kit 3.0.0-alpha.73 → 3.0.0-alpha.75
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.
|
@@ -5,9 +5,41 @@ import type { ReactNode } from 'react';
|
|
|
5
5
|
import { type ScrollAreaProps } from '../../../ui';
|
|
6
6
|
export interface ConversationRootProps extends PaperProps {
|
|
7
7
|
children: (messageIds: string[]) => ReactNode;
|
|
8
|
-
|
|
8
|
+
h: string;
|
|
9
|
+
scrollAreaProps?: Omit<ScrollAreaProps, 'children' | 'h'>;
|
|
9
10
|
withScrollButton?: boolean;
|
|
10
11
|
stackProps?: StackProps;
|
|
11
12
|
chatOptions?: UseChatOptions<UIMessage> & ChatInit<UIMessage>;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Корневой компонент чата
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { Chat } from '@rolder/kit';
|
|
20
|
+
*
|
|
21
|
+
* const MyChat = () => {
|
|
22
|
+
* return (
|
|
23
|
+
* <Chat.Root h="calc(100vh - 202px)">
|
|
24
|
+
* {(messageIds) => (
|
|
25
|
+
* <>
|
|
26
|
+
* {messageIds.map((messageId) => (
|
|
27
|
+
* <Chat.Message key={messageId} messageId={messageId} />
|
|
28
|
+
* ))}
|
|
29
|
+
* <Chat.Empty />
|
|
30
|
+
* <Chat.Loader />
|
|
31
|
+
* </>
|
|
32
|
+
* )}
|
|
33
|
+
* </Chat.Root>
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param children - Render-функция, принимающая массив ID сообщений
|
|
39
|
+
* @param h - Высота компонента (обязательный параметр)
|
|
40
|
+
* @param chatOptions - Опции для инициализации чата (API endpoint, начальные сообщения и т.д.)
|
|
41
|
+
* @param scrollAreaProps - Пропсы для ScrollArea
|
|
42
|
+
* @param withScrollButton - Показывать кнопку прокрутки (по умолчанию true)
|
|
43
|
+
* @param stackProps - Пропсы для Stack контейнера
|
|
44
|
+
*/
|
|
45
|
+
export declare const Root: ({ children, h, scrollAreaProps, withScrollButton, stackProps, chatOptions, ...props }: ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/ai/ui/chat/Root.js
CHANGED
|
@@ -6,7 +6,7 @@ const ChatInitializer = ({ chatOptions })=>{
|
|
|
6
6
|
useInitChat(chatOptions);
|
|
7
7
|
return null;
|
|
8
8
|
};
|
|
9
|
-
const Root = ({ children, scrollAreaProps, withScrollButton = true, stackProps, chatOptions, ...props })=>{
|
|
9
|
+
const Root = ({ children, h, scrollAreaProps, withScrollButton = true, stackProps, chatOptions, ...props })=>{
|
|
10
10
|
const messageIds = useChatMessageIds();
|
|
11
11
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
12
12
|
children: [
|
|
@@ -21,6 +21,7 @@ const Root = ({ children, scrollAreaProps, withScrollButton = true, stackProps,
|
|
|
21
21
|
autoScroll: true,
|
|
22
22
|
scrollToBottomOnInit: true,
|
|
23
23
|
p: "md",
|
|
24
|
+
h: h,
|
|
24
25
|
...scrollAreaProps,
|
|
25
26
|
children: [
|
|
26
27
|
/*#__PURE__*/ jsx(Stack, {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export declare const Chat: {
|
|
2
|
-
Root: ({ children, scrollAreaProps, withScrollButton, stackProps, chatOptions, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
Messages: ({ children, ...props }: Omit<import("@mantine/core").StackProps, "children"> & {
|
|
4
|
-
children: (messageIds: string[]) => import("react").ReactNode;
|
|
5
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
Root: ({ children, h, scrollAreaProps, withScrollButton, stackProps, chatOptions, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
3
|
Message: import("react").MemoExoticComponent<({ messageId }: {
|
|
7
4
|
messageId: string;
|
|
8
5
|
}) => import("react/jsx-runtime").JSX.Element | null>;
|
package/dist/ai/ui/chat/index.js
CHANGED
|
@@ -2,13 +2,11 @@ import { Empty } from "./Empty.js";
|
|
|
2
2
|
import { File } from "./File.js";
|
|
3
3
|
import { Loader } from "./Loader.js";
|
|
4
4
|
import { Message } from "./Message.js";
|
|
5
|
-
import { Messages } from "./Messages.js";
|
|
6
5
|
import { Root } from "./Root.js";
|
|
7
6
|
import { ChatInput } from "./chatInput/index.js";
|
|
8
7
|
export * from "./store/index.js";
|
|
9
8
|
const Chat = {
|
|
10
9
|
Root: Root,
|
|
11
|
-
Messages: Messages,
|
|
12
10
|
Message: Message,
|
|
13
11
|
File: File,
|
|
14
12
|
Empty: Empty,
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type StackProps } from '@mantine/core';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
type MessagesProps = Omit<StackProps, 'children'> & {
|
|
4
|
-
children: (messageIds: string[]) => ReactNode;
|
|
5
|
-
};
|
|
6
|
-
export declare const Messages: ({ children, ...props }: MessagesProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Stack } from "@mantine/core";
|
|
3
|
-
import { useChatMessageIds } from "./store/index.js";
|
|
4
|
-
const Messages = ({ children, ...props })=>{
|
|
5
|
-
const messageIds = useChatMessageIds();
|
|
6
|
-
return /*#__PURE__*/ jsx(Stack, {
|
|
7
|
-
...props,
|
|
8
|
-
children: 'function' == typeof children ? children(messageIds) : null
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
export { Messages };
|