@assistant-ui/react 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +40 -13
- package/dist/index.d.ts +40 -13
- package/dist/index.js +367 -292
- package/dist/index.mjs +355 -280
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
import { UseChatHelpers } from 'ai/react';
|
2
1
|
import * as react from 'react';
|
3
2
|
import { FC, PropsWithChildren } from 'react';
|
3
|
+
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
4
4
|
import { Message } from 'ai';
|
5
|
-
|
6
|
-
type ThreadProviderProps = {
|
7
|
-
chat: UseChatHelpers;
|
8
|
-
children: React.ReactNode;
|
9
|
-
};
|
10
|
-
declare const ThreadProvider: FC<ThreadProviderProps>;
|
5
|
+
import { UseChatHelpers } from 'ai/react';
|
11
6
|
|
12
7
|
declare const ThreadRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
13
8
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
@@ -39,13 +34,21 @@ declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.De
|
|
39
34
|
|
40
35
|
type ThreadMessagesProps = {
|
41
36
|
components: {
|
42
|
-
Message: React.ComponentType
|
37
|
+
Message: React.ComponentType;
|
38
|
+
UserMessage?: React.ComponentType;
|
39
|
+
EditingUserMessage?: React.ComponentType;
|
40
|
+
AssistantMessage?: React.ComponentType;
|
41
|
+
} | {
|
42
|
+
Message?: React.ComponentType;
|
43
|
+
UserMessage: React.ComponentType;
|
44
|
+
EditingUserMessage?: React.ComponentType;
|
45
|
+
AssistantMessage: React.ComponentType;
|
43
46
|
};
|
44
47
|
};
|
45
48
|
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
46
49
|
|
47
50
|
declare namespace index$5 {
|
48
|
-
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages,
|
51
|
+
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadViewport as Viewport };
|
49
52
|
}
|
50
53
|
|
51
54
|
declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & {
|
@@ -54,7 +57,7 @@ declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Deta
|
|
54
57
|
asChild?: boolean;
|
55
58
|
}, "key" | "asChild" | keyof react.FormHTMLAttributes<HTMLFormElement>> & react.RefAttributes<HTMLFormElement>>;
|
56
59
|
|
57
|
-
declare const ComposerInput: react.ForwardRefExoticComponent<
|
60
|
+
declare const ComposerInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
|
58
61
|
asChild?: boolean;
|
59
62
|
} & react.RefAttributes<HTMLTextAreaElement>>;
|
60
63
|
|
@@ -101,7 +104,7 @@ declare const MessageIf: FC<MessageIfProps>;
|
|
101
104
|
|
102
105
|
declare const MessageContent: FC;
|
103
106
|
|
104
|
-
declare const MessageEditableContent: react.ForwardRefExoticComponent<
|
107
|
+
declare const MessageEditableContent: react.ForwardRefExoticComponent<TextareaAutosizeProps & react.RefAttributes<HTMLTextAreaElement>>;
|
105
108
|
|
106
109
|
declare namespace index$3 {
|
107
110
|
export { MessageContent as Content, MessageEditableContent as EditableContent, MessageIf as If, MessageProvider as Provider, MessageRoot as Root };
|
@@ -127,7 +130,9 @@ declare const BranchPickerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.
|
|
127
130
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
128
131
|
} & {
|
129
132
|
asChild?: boolean;
|
130
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
133
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
134
|
+
hideWhenSingleBranch?: boolean;
|
135
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
131
136
|
|
132
137
|
declare namespace index$2 {
|
133
138
|
export { BranchPickerCount as Count, BranchPickerNext as Next, BranchPickerNumber as Number, BranchPickerPrevious as Previous, BranchPickerRoot as Root };
|
@@ -186,6 +191,12 @@ declare namespace index {
|
|
186
191
|
export { EditBarCancel as Cancel, EditBarRoot as Root, EditBarSave as Save };
|
187
192
|
}
|
188
193
|
|
194
|
+
type ThreadProviderProps = {
|
195
|
+
chat: UseChatHelpers;
|
196
|
+
children: React.ReactNode;
|
197
|
+
};
|
198
|
+
declare const VercelAIThreadProvider: FC<ThreadProviderProps>;
|
199
|
+
|
189
200
|
type BranchState = {
|
190
201
|
branchId: number;
|
191
202
|
branchCount: number;
|
@@ -209,4 +220,20 @@ type MessageStore = {
|
|
209
220
|
};
|
210
221
|
declare const useMessageContext: <Selection>(consumerName: string, selector: (s: MessageStore) => Selection) => Selection;
|
211
222
|
|
212
|
-
|
223
|
+
declare const useCopyMessage: ({ copiedDuration }: {
|
224
|
+
copiedDuration?: number | undefined;
|
225
|
+
}) => (() => void) | null;
|
226
|
+
|
227
|
+
declare const useReloadMessage: () => (() => Promise<void>) | null;
|
228
|
+
|
229
|
+
declare const useBeginMessageEdit: () => (() => void) | null;
|
230
|
+
|
231
|
+
declare const useCancelMessageEdit: () => (() => void) | null;
|
232
|
+
|
233
|
+
declare const useSaveMessageEdit: () => (() => void) | null;
|
234
|
+
|
235
|
+
declare const useGoToNextBranch: () => (() => void) | null;
|
236
|
+
|
237
|
+
declare const useGoToPreviousBranch: () => (() => void) | null;
|
238
|
+
|
239
|
+
export { index$1 as ActionBarPrimitive, index$2 as BranchPickerPrimitive, index$4 as ComposerPrimitive, index as EditBarPrimitive, index$3 as MessagePrimitive, index$5 as ThreadPrimitive, VercelAIThreadProvider, useMessageContext as unstable_useMessageContext, useBeginMessageEdit, useCancelMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useReloadMessage, useSaveMessageEdit };
|
package/dist/index.d.ts
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
import { UseChatHelpers } from 'ai/react';
|
2
1
|
import * as react from 'react';
|
3
2
|
import { FC, PropsWithChildren } from 'react';
|
3
|
+
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
4
4
|
import { Message } from 'ai';
|
5
|
-
|
6
|
-
type ThreadProviderProps = {
|
7
|
-
chat: UseChatHelpers;
|
8
|
-
children: React.ReactNode;
|
9
|
-
};
|
10
|
-
declare const ThreadProvider: FC<ThreadProviderProps>;
|
5
|
+
import { UseChatHelpers } from 'ai/react';
|
11
6
|
|
12
7
|
declare const ThreadRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
13
8
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
@@ -39,13 +34,21 @@ declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.De
|
|
39
34
|
|
40
35
|
type ThreadMessagesProps = {
|
41
36
|
components: {
|
42
|
-
Message: React.ComponentType
|
37
|
+
Message: React.ComponentType;
|
38
|
+
UserMessage?: React.ComponentType;
|
39
|
+
EditingUserMessage?: React.ComponentType;
|
40
|
+
AssistantMessage?: React.ComponentType;
|
41
|
+
} | {
|
42
|
+
Message?: React.ComponentType;
|
43
|
+
UserMessage: React.ComponentType;
|
44
|
+
EditingUserMessage?: React.ComponentType;
|
45
|
+
AssistantMessage: React.ComponentType;
|
43
46
|
};
|
44
47
|
};
|
45
48
|
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
46
49
|
|
47
50
|
declare namespace index$5 {
|
48
|
-
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages,
|
51
|
+
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadViewport as Viewport };
|
49
52
|
}
|
50
53
|
|
51
54
|
declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & {
|
@@ -54,7 +57,7 @@ declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Deta
|
|
54
57
|
asChild?: boolean;
|
55
58
|
}, "key" | "asChild" | keyof react.FormHTMLAttributes<HTMLFormElement>> & react.RefAttributes<HTMLFormElement>>;
|
56
59
|
|
57
|
-
declare const ComposerInput: react.ForwardRefExoticComponent<
|
60
|
+
declare const ComposerInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
|
58
61
|
asChild?: boolean;
|
59
62
|
} & react.RefAttributes<HTMLTextAreaElement>>;
|
60
63
|
|
@@ -101,7 +104,7 @@ declare const MessageIf: FC<MessageIfProps>;
|
|
101
104
|
|
102
105
|
declare const MessageContent: FC;
|
103
106
|
|
104
|
-
declare const MessageEditableContent: react.ForwardRefExoticComponent<
|
107
|
+
declare const MessageEditableContent: react.ForwardRefExoticComponent<TextareaAutosizeProps & react.RefAttributes<HTMLTextAreaElement>>;
|
105
108
|
|
106
109
|
declare namespace index$3 {
|
107
110
|
export { MessageContent as Content, MessageEditableContent as EditableContent, MessageIf as If, MessageProvider as Provider, MessageRoot as Root };
|
@@ -127,7 +130,9 @@ declare const BranchPickerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.
|
|
127
130
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
128
131
|
} & {
|
129
132
|
asChild?: boolean;
|
130
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
133
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
134
|
+
hideWhenSingleBranch?: boolean;
|
135
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
131
136
|
|
132
137
|
declare namespace index$2 {
|
133
138
|
export { BranchPickerCount as Count, BranchPickerNext as Next, BranchPickerNumber as Number, BranchPickerPrevious as Previous, BranchPickerRoot as Root };
|
@@ -186,6 +191,12 @@ declare namespace index {
|
|
186
191
|
export { EditBarCancel as Cancel, EditBarRoot as Root, EditBarSave as Save };
|
187
192
|
}
|
188
193
|
|
194
|
+
type ThreadProviderProps = {
|
195
|
+
chat: UseChatHelpers;
|
196
|
+
children: React.ReactNode;
|
197
|
+
};
|
198
|
+
declare const VercelAIThreadProvider: FC<ThreadProviderProps>;
|
199
|
+
|
189
200
|
type BranchState = {
|
190
201
|
branchId: number;
|
191
202
|
branchCount: number;
|
@@ -209,4 +220,20 @@ type MessageStore = {
|
|
209
220
|
};
|
210
221
|
declare const useMessageContext: <Selection>(consumerName: string, selector: (s: MessageStore) => Selection) => Selection;
|
211
222
|
|
212
|
-
|
223
|
+
declare const useCopyMessage: ({ copiedDuration }: {
|
224
|
+
copiedDuration?: number | undefined;
|
225
|
+
}) => (() => void) | null;
|
226
|
+
|
227
|
+
declare const useReloadMessage: () => (() => Promise<void>) | null;
|
228
|
+
|
229
|
+
declare const useBeginMessageEdit: () => (() => void) | null;
|
230
|
+
|
231
|
+
declare const useCancelMessageEdit: () => (() => void) | null;
|
232
|
+
|
233
|
+
declare const useSaveMessageEdit: () => (() => void) | null;
|
234
|
+
|
235
|
+
declare const useGoToNextBranch: () => (() => void) | null;
|
236
|
+
|
237
|
+
declare const useGoToPreviousBranch: () => (() => void) | null;
|
238
|
+
|
239
|
+
export { index$1 as ActionBarPrimitive, index$2 as BranchPickerPrimitive, index$4 as ComposerPrimitive, index as EditBarPrimitive, index$3 as MessagePrimitive, index$5 as ThreadPrimitive, VercelAIThreadProvider, useMessageContext as unstable_useMessageContext, useBeginMessageEdit, useCancelMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useReloadMessage, useSaveMessageEdit };
|