@assistant-ui/react 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +253 -231
- package/dist/index.mjs +256 -232
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -21,7 +21,7 @@ type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyo
|
|
21
21
|
|
22
22
|
type ThreadIfFilters = {
|
23
23
|
empty: boolean | undefined;
|
24
|
-
|
24
|
+
running: boolean | undefined;
|
25
25
|
};
|
26
26
|
type ThreadIfProps = PropsWithChildren<RequireAtLeastOne<ThreadIfFilters>>;
|
27
27
|
declare const ThreadIf: FC<ThreadIfProps>;
|
@@ -91,22 +91,16 @@ declare namespace index$3 {
|
|
91
91
|
export { ComposerCancel as Cancel, ComposerIf as If, ComposerInput as Input, ComposerRoot as Root, ComposerSend as Send };
|
92
92
|
}
|
93
93
|
|
94
|
-
type
|
95
|
-
|
96
|
-
|
94
|
+
type BaseComposerState = {
|
95
|
+
value: string;
|
96
|
+
setValue: (value: string) => void;
|
97
97
|
};
|
98
|
-
|
99
|
-
type ComposerState = {
|
98
|
+
type MessageComposerState = BaseComposerState & {
|
100
99
|
isEditing: boolean;
|
101
|
-
canCancel:
|
100
|
+
canCancel: true;
|
102
101
|
edit: () => void;
|
103
102
|
send: () => void;
|
104
103
|
cancel: () => void;
|
105
|
-
value: string;
|
106
|
-
setValue: (value: string) => void;
|
107
|
-
};
|
108
|
-
type ComposerStore = {
|
109
|
-
useComposer: UseBoundStore<StoreApi<ComposerState>>;
|
110
104
|
};
|
111
105
|
|
112
106
|
type ThreadMessageTextPart = {
|
@@ -129,18 +123,23 @@ type ThreadMessageToolCallPart = {
|
|
129
123
|
};
|
130
124
|
type ThreadUserMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart;
|
131
125
|
type ThreadAssistantMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart | ThreadMessageToolCallPart;
|
132
|
-
type
|
126
|
+
type ThreadMessageBase = {
|
133
127
|
id: string;
|
128
|
+
parentId: string;
|
129
|
+
createdAt: Date;
|
130
|
+
branchId: number;
|
131
|
+
branchCount: number;
|
132
|
+
};
|
133
|
+
type ThreadUserMessage = ThreadMessageBase & {
|
134
134
|
role: "user";
|
135
135
|
content: ThreadUserMessageContent[];
|
136
136
|
};
|
137
|
-
type ThreadAssistantMessage = {
|
138
|
-
id: string;
|
137
|
+
type ThreadAssistantMessage = ThreadMessageBase & {
|
139
138
|
role: "assistant";
|
140
139
|
content: ThreadAssistantMessageContent[];
|
141
140
|
};
|
142
141
|
type ThreadMessage = ThreadUserMessage | ThreadAssistantMessage;
|
143
|
-
type CreateThreadMessage = Omit<ThreadUserMessage, "id">;
|
142
|
+
type CreateThreadMessage = Omit<ThreadUserMessage, "id" | "branchId" | "branchCount" | "createdAt" | "role">;
|
144
143
|
|
145
144
|
type MessageProviderProps = {
|
146
145
|
children?: React.ReactNode;
|
@@ -226,7 +225,7 @@ declare const ActionBarRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Det
|
|
226
225
|
} & {
|
227
226
|
asChild?: boolean;
|
228
227
|
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
229
|
-
|
228
|
+
hideWhenRunning?: boolean;
|
230
229
|
autohide?: "always" | "not-last" | "never";
|
231
230
|
autohideFloat?: "always" | "single-branch" | "never";
|
232
231
|
} & react.RefAttributes<HTMLDivElement>>;
|
@@ -267,6 +266,7 @@ type RSCMessage = {
|
|
267
266
|
id: string;
|
268
267
|
role: "user" | "assistant";
|
269
268
|
display: ReactNode;
|
269
|
+
createdAt?: Date;
|
270
270
|
};
|
271
271
|
type VercelAIAssistantProviderProps = PropsWithChildren<{
|
272
272
|
messages: RSCMessage[];
|
@@ -276,15 +276,15 @@ declare const VercelRSCAssistantProvider: FC<VercelAIAssistantProviderProps>;
|
|
276
276
|
|
277
277
|
type MessageState = {
|
278
278
|
message: ThreadMessage;
|
279
|
-
branchState: BranchState;
|
280
279
|
isLast: boolean;
|
281
280
|
isCopied: boolean;
|
282
281
|
setIsCopied: (value: boolean) => void;
|
283
282
|
isHovering: boolean;
|
284
283
|
setIsHovering: (value: boolean) => void;
|
285
284
|
};
|
286
|
-
type MessageStore =
|
285
|
+
type MessageStore = {
|
287
286
|
useMessage: UseBoundStore<StoreApi<MessageState>>;
|
287
|
+
useComposer: UseBoundStore<StoreApi<MessageComposerState>>;
|
288
288
|
};
|
289
289
|
|
290
290
|
declare const useMessageContext: () => MessageStore;
|
package/dist/index.d.ts
CHANGED
@@ -21,7 +21,7 @@ type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyo
|
|
21
21
|
|
22
22
|
type ThreadIfFilters = {
|
23
23
|
empty: boolean | undefined;
|
24
|
-
|
24
|
+
running: boolean | undefined;
|
25
25
|
};
|
26
26
|
type ThreadIfProps = PropsWithChildren<RequireAtLeastOne<ThreadIfFilters>>;
|
27
27
|
declare const ThreadIf: FC<ThreadIfProps>;
|
@@ -91,22 +91,16 @@ declare namespace index$3 {
|
|
91
91
|
export { ComposerCancel as Cancel, ComposerIf as If, ComposerInput as Input, ComposerRoot as Root, ComposerSend as Send };
|
92
92
|
}
|
93
93
|
|
94
|
-
type
|
95
|
-
|
96
|
-
|
94
|
+
type BaseComposerState = {
|
95
|
+
value: string;
|
96
|
+
setValue: (value: string) => void;
|
97
97
|
};
|
98
|
-
|
99
|
-
type ComposerState = {
|
98
|
+
type MessageComposerState = BaseComposerState & {
|
100
99
|
isEditing: boolean;
|
101
|
-
canCancel:
|
100
|
+
canCancel: true;
|
102
101
|
edit: () => void;
|
103
102
|
send: () => void;
|
104
103
|
cancel: () => void;
|
105
|
-
value: string;
|
106
|
-
setValue: (value: string) => void;
|
107
|
-
};
|
108
|
-
type ComposerStore = {
|
109
|
-
useComposer: UseBoundStore<StoreApi<ComposerState>>;
|
110
104
|
};
|
111
105
|
|
112
106
|
type ThreadMessageTextPart = {
|
@@ -129,18 +123,23 @@ type ThreadMessageToolCallPart = {
|
|
129
123
|
};
|
130
124
|
type ThreadUserMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart;
|
131
125
|
type ThreadAssistantMessageContent = ThreadMessageTextPart | ThreadMessageImagePart | ThreadMessageUIPart | ThreadMessageToolCallPart;
|
132
|
-
type
|
126
|
+
type ThreadMessageBase = {
|
133
127
|
id: string;
|
128
|
+
parentId: string;
|
129
|
+
createdAt: Date;
|
130
|
+
branchId: number;
|
131
|
+
branchCount: number;
|
132
|
+
};
|
133
|
+
type ThreadUserMessage = ThreadMessageBase & {
|
134
134
|
role: "user";
|
135
135
|
content: ThreadUserMessageContent[];
|
136
136
|
};
|
137
|
-
type ThreadAssistantMessage = {
|
138
|
-
id: string;
|
137
|
+
type ThreadAssistantMessage = ThreadMessageBase & {
|
139
138
|
role: "assistant";
|
140
139
|
content: ThreadAssistantMessageContent[];
|
141
140
|
};
|
142
141
|
type ThreadMessage = ThreadUserMessage | ThreadAssistantMessage;
|
143
|
-
type CreateThreadMessage = Omit<ThreadUserMessage, "id">;
|
142
|
+
type CreateThreadMessage = Omit<ThreadUserMessage, "id" | "branchId" | "branchCount" | "createdAt" | "role">;
|
144
143
|
|
145
144
|
type MessageProviderProps = {
|
146
145
|
children?: React.ReactNode;
|
@@ -226,7 +225,7 @@ declare const ActionBarRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Det
|
|
226
225
|
} & {
|
227
226
|
asChild?: boolean;
|
228
227
|
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
229
|
-
|
228
|
+
hideWhenRunning?: boolean;
|
230
229
|
autohide?: "always" | "not-last" | "never";
|
231
230
|
autohideFloat?: "always" | "single-branch" | "never";
|
232
231
|
} & react.RefAttributes<HTMLDivElement>>;
|
@@ -267,6 +266,7 @@ type RSCMessage = {
|
|
267
266
|
id: string;
|
268
267
|
role: "user" | "assistant";
|
269
268
|
display: ReactNode;
|
269
|
+
createdAt?: Date;
|
270
270
|
};
|
271
271
|
type VercelAIAssistantProviderProps = PropsWithChildren<{
|
272
272
|
messages: RSCMessage[];
|
@@ -276,15 +276,15 @@ declare const VercelRSCAssistantProvider: FC<VercelAIAssistantProviderProps>;
|
|
276
276
|
|
277
277
|
type MessageState = {
|
278
278
|
message: ThreadMessage;
|
279
|
-
branchState: BranchState;
|
280
279
|
isLast: boolean;
|
281
280
|
isCopied: boolean;
|
282
281
|
setIsCopied: (value: boolean) => void;
|
283
282
|
isHovering: boolean;
|
284
283
|
setIsHovering: (value: boolean) => void;
|
285
284
|
};
|
286
|
-
type MessageStore =
|
285
|
+
type MessageStore = {
|
287
286
|
useMessage: UseBoundStore<StoreApi<MessageState>>;
|
287
|
+
useComposer: UseBoundStore<StoreApi<MessageComposerState>>;
|
288
288
|
};
|
289
289
|
|
290
290
|
declare const useMessageContext: () => MessageStore;
|