@assistant-ui/react 0.0.7 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +21 -12
- package/dist/index.d.ts +21 -12
- package/dist/index.js +412 -328
- package/dist/index.mjs +403 -318
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -30,7 +30,9 @@ declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.De
|
|
30
30
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
31
31
|
} & {
|
32
32
|
asChild?: boolean;
|
33
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
33
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
34
|
+
autoScroll?: boolean;
|
35
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
34
36
|
|
35
37
|
type ThreadMessagesProps = {
|
36
38
|
components: {
|
@@ -47,8 +49,14 @@ type ThreadMessagesProps = {
|
|
47
49
|
};
|
48
50
|
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
49
51
|
|
52
|
+
declare const ThreadScrollToBottom: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
53
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
54
|
+
} & {
|
55
|
+
asChild?: boolean;
|
56
|
+
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
57
|
+
|
50
58
|
declare namespace index$4 {
|
51
|
-
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadViewport as Viewport };
|
59
|
+
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadScrollToBottom as ScrollToBottom, ThreadViewport as Viewport };
|
52
60
|
}
|
53
61
|
|
54
62
|
declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & {
|
@@ -83,11 +91,6 @@ declare namespace index$3 {
|
|
83
91
|
export { ComposerCancel as Cancel, ComposerIf as If, ComposerInput as Input, ComposerRoot as Root, ComposerSend as Send };
|
84
92
|
}
|
85
93
|
|
86
|
-
type BranchState = {
|
87
|
-
branchId: number;
|
88
|
-
branchCount: number;
|
89
|
-
};
|
90
|
-
|
91
94
|
type ComposerState = {
|
92
95
|
isEditing: boolean;
|
93
96
|
canCancel: boolean;
|
@@ -121,18 +124,23 @@ type ThreadMessageToolCallPart = {
|
|
121
124
|
};
|
122
125
|
type ThreadUserMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart;
|
123
126
|
type ThreadAssistantMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart | ThreadMessageToolCallPart;
|
124
|
-
type
|
127
|
+
type ThreadMessageBase = {
|
125
128
|
id: string;
|
129
|
+
parentId: string;
|
130
|
+
createdAt: Date;
|
131
|
+
branchId: number;
|
132
|
+
branchCount: number;
|
133
|
+
};
|
134
|
+
type ThreadUserMessage = ThreadMessageBase & {
|
126
135
|
role: "user";
|
127
136
|
content: ThreadUserMessageContent[];
|
128
137
|
};
|
129
|
-
type ThreadAssistantMessage = {
|
130
|
-
id: string;
|
138
|
+
type ThreadAssistantMessage = ThreadMessageBase & {
|
131
139
|
role: "assistant";
|
132
140
|
content: ThreadAssistantMessageContent[];
|
133
141
|
};
|
134
142
|
type ThreadMessage = ThreadUserMessage | ThreadAssistantMessage;
|
135
|
-
type CreateThreadMessage = Omit<ThreadUserMessage, "id">;
|
143
|
+
type CreateThreadMessage = Omit<ThreadUserMessage, "id" | "branchId" | "branchCount" | "createdAt" | "role">;
|
136
144
|
|
137
145
|
type MessageProviderProps = {
|
138
146
|
children?: React.ReactNode;
|
@@ -259,6 +267,7 @@ type RSCMessage = {
|
|
259
267
|
id: string;
|
260
268
|
role: "user" | "assistant";
|
261
269
|
display: ReactNode;
|
270
|
+
createdAt?: Date;
|
262
271
|
};
|
263
272
|
type VercelAIAssistantProviderProps = PropsWithChildren<{
|
264
273
|
messages: RSCMessage[];
|
@@ -268,7 +277,6 @@ declare const VercelRSCAssistantProvider: FC<VercelAIAssistantProviderProps>;
|
|
268
277
|
|
269
278
|
type MessageState = {
|
270
279
|
message: ThreadMessage;
|
271
|
-
branchState: BranchState;
|
272
280
|
isLast: boolean;
|
273
281
|
isCopied: boolean;
|
274
282
|
setIsCopied: (value: boolean) => void;
|
@@ -278,6 +286,7 @@ type MessageState = {
|
|
278
286
|
type MessageStore = ComposerStore & {
|
279
287
|
useMessage: UseBoundStore<StoreApi<MessageState>>;
|
280
288
|
};
|
289
|
+
|
281
290
|
declare const useMessageContext: () => MessageStore;
|
282
291
|
|
283
292
|
declare const useCopyMessage: ({ copiedDuration }: {
|
package/dist/index.d.ts
CHANGED
@@ -30,7 +30,9 @@ declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.De
|
|
30
30
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
31
31
|
} & {
|
32
32
|
asChild?: boolean;
|
33
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
33
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
34
|
+
autoScroll?: boolean;
|
35
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
34
36
|
|
35
37
|
type ThreadMessagesProps = {
|
36
38
|
components: {
|
@@ -47,8 +49,14 @@ type ThreadMessagesProps = {
|
|
47
49
|
};
|
48
50
|
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
49
51
|
|
52
|
+
declare const ThreadScrollToBottom: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
53
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
54
|
+
} & {
|
55
|
+
asChild?: boolean;
|
56
|
+
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
57
|
+
|
50
58
|
declare namespace index$4 {
|
51
|
-
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadViewport as Viewport };
|
59
|
+
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadScrollToBottom as ScrollToBottom, ThreadViewport as Viewport };
|
52
60
|
}
|
53
61
|
|
54
62
|
declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & {
|
@@ -83,11 +91,6 @@ declare namespace index$3 {
|
|
83
91
|
export { ComposerCancel as Cancel, ComposerIf as If, ComposerInput as Input, ComposerRoot as Root, ComposerSend as Send };
|
84
92
|
}
|
85
93
|
|
86
|
-
type BranchState = {
|
87
|
-
branchId: number;
|
88
|
-
branchCount: number;
|
89
|
-
};
|
90
|
-
|
91
94
|
type ComposerState = {
|
92
95
|
isEditing: boolean;
|
93
96
|
canCancel: boolean;
|
@@ -121,18 +124,23 @@ type ThreadMessageToolCallPart = {
|
|
121
124
|
};
|
122
125
|
type ThreadUserMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart;
|
123
126
|
type ThreadAssistantMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart | ThreadMessageToolCallPart;
|
124
|
-
type
|
127
|
+
type ThreadMessageBase = {
|
125
128
|
id: string;
|
129
|
+
parentId: string;
|
130
|
+
createdAt: Date;
|
131
|
+
branchId: number;
|
132
|
+
branchCount: number;
|
133
|
+
};
|
134
|
+
type ThreadUserMessage = ThreadMessageBase & {
|
126
135
|
role: "user";
|
127
136
|
content: ThreadUserMessageContent[];
|
128
137
|
};
|
129
|
-
type ThreadAssistantMessage = {
|
130
|
-
id: string;
|
138
|
+
type ThreadAssistantMessage = ThreadMessageBase & {
|
131
139
|
role: "assistant";
|
132
140
|
content: ThreadAssistantMessageContent[];
|
133
141
|
};
|
134
142
|
type ThreadMessage = ThreadUserMessage | ThreadAssistantMessage;
|
135
|
-
type CreateThreadMessage = Omit<ThreadUserMessage, "id">;
|
143
|
+
type CreateThreadMessage = Omit<ThreadUserMessage, "id" | "branchId" | "branchCount" | "createdAt" | "role">;
|
136
144
|
|
137
145
|
type MessageProviderProps = {
|
138
146
|
children?: React.ReactNode;
|
@@ -259,6 +267,7 @@ type RSCMessage = {
|
|
259
267
|
id: string;
|
260
268
|
role: "user" | "assistant";
|
261
269
|
display: ReactNode;
|
270
|
+
createdAt?: Date;
|
262
271
|
};
|
263
272
|
type VercelAIAssistantProviderProps = PropsWithChildren<{
|
264
273
|
messages: RSCMessage[];
|
@@ -268,7 +277,6 @@ declare const VercelRSCAssistantProvider: FC<VercelAIAssistantProviderProps>;
|
|
268
277
|
|
269
278
|
type MessageState = {
|
270
279
|
message: ThreadMessage;
|
271
|
-
branchState: BranchState;
|
272
280
|
isLast: boolean;
|
273
281
|
isCopied: boolean;
|
274
282
|
setIsCopied: (value: boolean) => void;
|
@@ -278,6 +286,7 @@ type MessageState = {
|
|
278
286
|
type MessageStore = ComposerStore & {
|
279
287
|
useMessage: UseBoundStore<StoreApi<MessageState>>;
|
280
288
|
};
|
289
|
+
|
281
290
|
declare const useMessageContext: () => MessageStore;
|
282
291
|
|
283
292
|
declare const useCopyMessage: ({ copiedDuration }: {
|