@assistant-ui/react 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +20 -18
- package/dist/index.d.ts +20 -18
- package/dist/index.js +455 -339
- package/dist/index.mjs +429 -313
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as react from 'react';
|
2
|
-
import { FC,
|
2
|
+
import { FC, ReactNode, PropsWithChildren, ComponentType } from 'react';
|
3
3
|
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
4
4
|
import { UseChatHelpers, UseAssistantHelpers } from 'ai/react';
|
5
5
|
import { UseBoundStore, StoreApi } from 'zustand';
|
@@ -11,7 +11,7 @@ declare const ThreadRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Detail
|
|
11
11
|
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & react.RefAttributes<HTMLDivElement>>;
|
12
12
|
|
13
13
|
type ThreadEmptyProps = {
|
14
|
-
children:
|
14
|
+
children: ReactNode;
|
15
15
|
};
|
16
16
|
declare const ThreadEmpty: FC<ThreadEmptyProps>;
|
17
17
|
|
@@ -36,15 +36,15 @@ declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.De
|
|
36
36
|
|
37
37
|
type ThreadMessagesProps = {
|
38
38
|
components: {
|
39
|
-
Message:
|
40
|
-
UserMessage?:
|
41
|
-
EditComposer?:
|
42
|
-
AssistantMessage?:
|
39
|
+
Message: ComponentType;
|
40
|
+
UserMessage?: ComponentType;
|
41
|
+
EditComposer?: ComponentType;
|
42
|
+
AssistantMessage?: ComponentType;
|
43
43
|
} | {
|
44
|
-
Message?:
|
45
|
-
UserMessage:
|
46
|
-
EditComposer?:
|
47
|
-
AssistantMessage:
|
44
|
+
Message?: ComponentType;
|
45
|
+
UserMessage: ComponentType;
|
46
|
+
EditComposer?: ComponentType;
|
47
|
+
AssistantMessage: ComponentType;
|
48
48
|
};
|
49
49
|
};
|
50
50
|
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
@@ -97,10 +97,9 @@ type BaseComposerState = {
|
|
97
97
|
};
|
98
98
|
type MessageComposerState = BaseComposerState & {
|
99
99
|
isEditing: boolean;
|
100
|
-
canCancel: true;
|
101
100
|
edit: () => void;
|
102
101
|
send: () => void;
|
103
|
-
cancel: () =>
|
102
|
+
cancel: () => boolean;
|
104
103
|
};
|
105
104
|
|
106
105
|
type ThreadMessageTextPart = {
|
@@ -121,14 +120,13 @@ type ThreadMessageToolCallPart = {
|
|
121
120
|
args: object;
|
122
121
|
result?: object;
|
123
122
|
};
|
123
|
+
type CreateThreadUserMessageContent = ThreadMessageTextPart | ThreadMessageImagePart;
|
124
124
|
type ThreadUserMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart;
|
125
125
|
type ThreadAssistantMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart | ThreadMessageToolCallPart;
|
126
126
|
type ThreadMessageBase = {
|
127
127
|
id: string;
|
128
|
-
parentId: string;
|
128
|
+
parentId: string | null;
|
129
129
|
createdAt: Date;
|
130
|
-
branchId: number;
|
131
|
-
branchCount: number;
|
132
130
|
};
|
133
131
|
type ThreadUserMessage = ThreadMessageBase & {
|
134
132
|
role: "user";
|
@@ -138,11 +136,14 @@ type ThreadAssistantMessage = ThreadMessageBase & {
|
|
138
136
|
role: "assistant";
|
139
137
|
content: ThreadAssistantMessageContent[];
|
140
138
|
};
|
139
|
+
type CreateThreadMessage = {
|
140
|
+
parentId: string | null;
|
141
|
+
content: CreateThreadUserMessageContent[];
|
142
|
+
};
|
141
143
|
type ThreadMessage = ThreadUserMessage | ThreadAssistantMessage;
|
142
|
-
type CreateThreadMessage = Omit<ThreadUserMessage, "id" | "branchId" | "branchCount" | "createdAt" | "role">;
|
143
144
|
|
144
145
|
type MessageProviderProps = {
|
145
|
-
children?:
|
146
|
+
children?: ReactNode;
|
146
147
|
message: ThreadMessage;
|
147
148
|
};
|
148
149
|
declare const MessageProvider: FC<MessageProviderProps>;
|
@@ -161,7 +162,7 @@ type MessageIfFilters = {
|
|
161
162
|
lastOrHover: boolean | undefined;
|
162
163
|
};
|
163
164
|
type MessageIfProps = RequireAtLeastOne<MessageIfFilters> & {
|
164
|
-
children:
|
165
|
+
children: ReactNode;
|
165
166
|
};
|
166
167
|
declare const MessageIf: FC<MessageIfProps>;
|
167
168
|
|
@@ -276,6 +277,7 @@ declare const VercelRSCAssistantProvider: FC<VercelAIAssistantProviderProps>;
|
|
276
277
|
|
277
278
|
type MessageState = {
|
278
279
|
message: ThreadMessage;
|
280
|
+
branches: string[];
|
279
281
|
isLast: boolean;
|
280
282
|
isCopied: boolean;
|
281
283
|
setIsCopied: (value: boolean) => void;
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as react from 'react';
|
2
|
-
import { FC,
|
2
|
+
import { FC, ReactNode, PropsWithChildren, ComponentType } from 'react';
|
3
3
|
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
4
4
|
import { UseChatHelpers, UseAssistantHelpers } from 'ai/react';
|
5
5
|
import { UseBoundStore, StoreApi } from 'zustand';
|
@@ -11,7 +11,7 @@ declare const ThreadRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Detail
|
|
11
11
|
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & react.RefAttributes<HTMLDivElement>>;
|
12
12
|
|
13
13
|
type ThreadEmptyProps = {
|
14
|
-
children:
|
14
|
+
children: ReactNode;
|
15
15
|
};
|
16
16
|
declare const ThreadEmpty: FC<ThreadEmptyProps>;
|
17
17
|
|
@@ -36,15 +36,15 @@ declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.De
|
|
36
36
|
|
37
37
|
type ThreadMessagesProps = {
|
38
38
|
components: {
|
39
|
-
Message:
|
40
|
-
UserMessage?:
|
41
|
-
EditComposer?:
|
42
|
-
AssistantMessage?:
|
39
|
+
Message: ComponentType;
|
40
|
+
UserMessage?: ComponentType;
|
41
|
+
EditComposer?: ComponentType;
|
42
|
+
AssistantMessage?: ComponentType;
|
43
43
|
} | {
|
44
|
-
Message?:
|
45
|
-
UserMessage:
|
46
|
-
EditComposer?:
|
47
|
-
AssistantMessage:
|
44
|
+
Message?: ComponentType;
|
45
|
+
UserMessage: ComponentType;
|
46
|
+
EditComposer?: ComponentType;
|
47
|
+
AssistantMessage: ComponentType;
|
48
48
|
};
|
49
49
|
};
|
50
50
|
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
@@ -97,10 +97,9 @@ type BaseComposerState = {
|
|
97
97
|
};
|
98
98
|
type MessageComposerState = BaseComposerState & {
|
99
99
|
isEditing: boolean;
|
100
|
-
canCancel: true;
|
101
100
|
edit: () => void;
|
102
101
|
send: () => void;
|
103
|
-
cancel: () =>
|
102
|
+
cancel: () => boolean;
|
104
103
|
};
|
105
104
|
|
106
105
|
type ThreadMessageTextPart = {
|
@@ -121,14 +120,13 @@ type ThreadMessageToolCallPart = {
|
|
121
120
|
args: object;
|
122
121
|
result?: object;
|
123
122
|
};
|
123
|
+
type CreateThreadUserMessageContent = ThreadMessageTextPart | ThreadMessageImagePart;
|
124
124
|
type ThreadUserMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart;
|
125
125
|
type ThreadAssistantMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart | ThreadMessageToolCallPart;
|
126
126
|
type ThreadMessageBase = {
|
127
127
|
id: string;
|
128
|
-
parentId: string;
|
128
|
+
parentId: string | null;
|
129
129
|
createdAt: Date;
|
130
|
-
branchId: number;
|
131
|
-
branchCount: number;
|
132
130
|
};
|
133
131
|
type ThreadUserMessage = ThreadMessageBase & {
|
134
132
|
role: "user";
|
@@ -138,11 +136,14 @@ type ThreadAssistantMessage = ThreadMessageBase & {
|
|
138
136
|
role: "assistant";
|
139
137
|
content: ThreadAssistantMessageContent[];
|
140
138
|
};
|
139
|
+
type CreateThreadMessage = {
|
140
|
+
parentId: string | null;
|
141
|
+
content: CreateThreadUserMessageContent[];
|
142
|
+
};
|
141
143
|
type ThreadMessage = ThreadUserMessage | ThreadAssistantMessage;
|
142
|
-
type CreateThreadMessage = Omit<ThreadUserMessage, "id" | "branchId" | "branchCount" | "createdAt" | "role">;
|
143
144
|
|
144
145
|
type MessageProviderProps = {
|
145
|
-
children?:
|
146
|
+
children?: ReactNode;
|
146
147
|
message: ThreadMessage;
|
147
148
|
};
|
148
149
|
declare const MessageProvider: FC<MessageProviderProps>;
|
@@ -161,7 +162,7 @@ type MessageIfFilters = {
|
|
161
162
|
lastOrHover: boolean | undefined;
|
162
163
|
};
|
163
164
|
type MessageIfProps = RequireAtLeastOne<MessageIfFilters> & {
|
164
|
-
children:
|
165
|
+
children: ReactNode;
|
165
166
|
};
|
166
167
|
declare const MessageIf: FC<MessageIfProps>;
|
167
168
|
|
@@ -276,6 +277,7 @@ declare const VercelRSCAssistantProvider: FC<VercelAIAssistantProviderProps>;
|
|
276
277
|
|
277
278
|
type MessageState = {
|
278
279
|
message: ThreadMessage;
|
280
|
+
branches: string[];
|
279
281
|
isLast: boolean;
|
280
282
|
isCopied: boolean;
|
281
283
|
setIsCopied: (value: boolean) => void;
|