@assistant-ui/react-native 0.1.0 → 0.1.2
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.
- package/LICENSE +21 -0
- package/README.md +2 -6
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/context/AssistantContext.d.ts.map +1 -1
- package/dist/context/AssistantContext.js +4 -9
- package/dist/context/AssistantContext.js.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.d.ts +2 -0
- package/dist/context/providers/AttachmentByIndexProvider.d.ts.map +1 -0
- package/dist/context/providers/AttachmentByIndexProvider.js +2 -0
- package/dist/context/providers/AttachmentByIndexProvider.js.map +1 -0
- package/dist/context/providers/RuntimeAdapterProvider.d.ts +2 -1
- package/dist/context/providers/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/context/providers/RuntimeAdapterProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts +1 -5
- package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadListItemRuntimeProvider.js +1 -9
- package/dist/context/providers/ThreadListItemRuntimeProvider.js.map +1 -1
- package/dist/index.d.ts +15 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/model-context/index.d.ts +9 -0
- package/dist/model-context/index.d.ts.map +1 -0
- package/dist/model-context/index.js +7 -0
- package/dist/model-context/index.js.map +1 -0
- package/dist/primitive-hooks/index.d.ts +1 -0
- package/dist/primitive-hooks/index.d.ts.map +1 -1
- package/dist/primitive-hooks/index.js +1 -0
- package/dist/primitive-hooks/index.js.map +1 -1
- package/dist/primitive-hooks/useComposerAddAttachment.d.ts +5 -0
- package/dist/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -0
- package/dist/primitive-hooks/useComposerAddAttachment.js +10 -0
- package/dist/primitive-hooks/useComposerAddAttachment.js.map +1 -0
- package/dist/primitive-hooks/useThreadIsRunning.js +2 -2
- package/dist/primitive-hooks/useThreadIsRunning.js.map +1 -1
- package/dist/primitives/attachment/AttachmentName.d.ts +5 -0
- package/dist/primitives/attachment/AttachmentName.d.ts.map +1 -0
- package/dist/primitives/attachment/AttachmentName.js +8 -0
- package/dist/primitives/attachment/AttachmentName.js.map +1 -0
- package/dist/primitives/attachment/AttachmentRemove.d.ts +7 -0
- package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -0
- package/dist/primitives/attachment/AttachmentRemove.js +12 -0
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -0
- package/dist/primitives/attachment/AttachmentRoot.d.ts +7 -0
- package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -0
- package/dist/primitives/attachment/AttachmentRoot.js +6 -0
- package/dist/primitives/attachment/AttachmentRoot.js.map +1 -0
- package/dist/primitives/attachment/AttachmentThumb.d.ts +5 -0
- package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -0
- package/dist/primitives/attachment/AttachmentThumb.js +11 -0
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -0
- package/dist/primitives/attachment/index.d.ts +5 -0
- package/dist/primitives/attachment/index.d.ts.map +1 -0
- package/dist/primitives/attachment/index.js +5 -0
- package/dist/primitives/attachment/index.js.map +1 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts +7 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +13 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts +7 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts.map +1 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js +6 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js.map +1 -0
- package/dist/primitives/chainOfThought/index.d.ts +4 -0
- package/dist/primitives/chainOfThought/index.d.ts.map +1 -0
- package/dist/primitives/chainOfThought/index.js +4 -0
- package/dist/primitives/chainOfThought/index.js.map +1 -0
- package/dist/primitives/composer/ComposerAddAttachment.d.ts +14 -0
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -0
- package/dist/primitives/composer/ComposerAddAttachment.js +17 -0
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -0
- package/dist/primitives/composer/ComposerAttachments.d.ts +18 -0
- package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -0
- package/dist/primitives/composer/ComposerAttachments.js +4 -0
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -0
- package/dist/primitives/composer/ComposerIf.d.ts +2 -0
- package/dist/primitives/composer/ComposerIf.d.ts.map +1 -0
- package/dist/primitives/composer/ComposerIf.js +2 -0
- package/dist/primitives/composer/ComposerIf.js.map +1 -0
- package/dist/primitives/composer/index.d.ts +3 -0
- package/dist/primitives/composer/index.d.ts.map +1 -1
- package/dist/primitives/composer/index.js +3 -0
- package/dist/primitives/composer/index.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.d.ts +12 -0
- package/dist/primitives/message/MessageAttachments.d.ts.map +1 -0
- package/dist/primitives/message/MessageAttachments.js +4 -0
- package/dist/primitives/message/MessageAttachments.js.map +1 -0
- package/dist/primitives/message/MessageContent.d.ts.map +1 -1
- package/dist/primitives/message/MessageContent.js +34 -9
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageIf.js +2 -2
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/message/MessageParts.d.ts +11 -0
- package/dist/primitives/message/MessageParts.d.ts.map +1 -0
- package/dist/primitives/message/MessageParts.js +37 -0
- package/dist/primitives/message/MessageParts.js.map +1 -0
- package/dist/primitives/message/index.d.ts +2 -0
- package/dist/primitives/message/index.d.ts.map +1 -1
- package/dist/primitives/message/index.js +2 -0
- package/dist/primitives/message/index.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionDescription.d.ts +7 -0
- package/dist/primitives/suggestion/SuggestionDescription.d.ts.map +1 -0
- package/dist/primitives/suggestion/SuggestionDescription.js +8 -0
- package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -0
- package/dist/primitives/suggestion/SuggestionTitle.d.ts +7 -0
- package/dist/primitives/suggestion/SuggestionTitle.d.ts.map +1 -0
- package/dist/primitives/suggestion/SuggestionTitle.js +8 -0
- package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -0
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts +18 -0
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts.map +1 -0
- package/dist/primitives/suggestion/SuggestionTrigger.js +35 -0
- package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -0
- package/dist/primitives/suggestion/index.d.ts +4 -0
- package/dist/primitives/suggestion/index.d.ts.map +1 -0
- package/dist/primitives/suggestion/index.js +4 -0
- package/dist/primitives/suggestion/index.js.map +1 -0
- package/dist/primitives/thread/ThreadIf.js +2 -2
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts +20 -0
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -0
- package/dist/primitives/thread/ThreadSuggestion.js +34 -0
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -0
- package/dist/primitives/thread/index.d.ts +3 -0
- package/dist/primitives/thread/index.d.ts.map +1 -1
- package/dist/primitives/thread/index.js +3 -0
- package/dist/primitives/thread/index.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +2 -2
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +7 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +12 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +7 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +12 -0
- package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +7 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +6 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +7 -0
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +12 -0
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +7 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +12 -0
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -0
- package/dist/primitives/threadListItem/index.d.ts +7 -0
- package/dist/primitives/threadListItem/index.d.ts.map +1 -0
- package/dist/primitives/threadListItem/index.js +7 -0
- package/dist/primitives/threadListItem/index.js.map +1 -0
- package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +2 -1
- package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.js +8 -2
- package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/runtimes/useLocalRuntime.js +7 -2
- package/dist/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/runtimes/useRemoteThreadListRuntime.js +14 -4
- package/dist/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/scopes/index.d.ts +3 -0
- package/dist/types/scopes/index.d.ts.map +1 -0
- package/dist/types/scopes/index.js +2 -0
- package/dist/types/scopes/index.js.map +1 -0
- package/package.json +14 -14
- package/src/client/index.ts +7 -0
- package/src/context/AssistantContext.tsx +6 -19
- package/src/context/providers/AttachmentByIndexProvider.tsx +4 -0
- package/src/context/providers/RuntimeAdapterProvider.tsx +2 -0
- package/src/context/providers/ThreadListItemRuntimeProvider.tsx +1 -16
- package/src/index.ts +52 -17
- package/src/model-context/index.ts +44 -0
- package/src/primitive-hooks/index.ts +1 -0
- package/src/primitive-hooks/useComposerAddAttachment.ts +16 -0
- package/src/primitive-hooks/useThreadIsRunning.ts +2 -2
- package/src/primitives/attachment/AttachmentName.tsx +10 -0
- package/src/primitives/attachment/AttachmentRemove.tsx +25 -0
- package/src/primitives/attachment/AttachmentRoot.tsx +13 -0
- package/src/primitives/attachment/AttachmentThumb.tsx +13 -0
- package/src/primitives/attachment/index.ts +7 -0
- package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.tsx +28 -0
- package/src/primitives/chainOfThought/ChainOfThoughtRoot.tsx +13 -0
- package/src/primitives/chainOfThought/index.ts +9 -0
- package/src/primitives/composer/ComposerAddAttachment.tsx +30 -0
- package/src/primitives/composer/ComposerAttachments.tsx +25 -0
- package/src/primitives/composer/ComposerIf.tsx +1 -0
- package/src/primitives/composer/index.ts +9 -0
- package/src/primitives/message/MessageAttachments.tsx +18 -0
- package/src/primitives/message/MessageContent.tsx +82 -7
- package/src/primitives/message/MessageIf.tsx +2 -2
- package/src/primitives/message/MessageParts.tsx +60 -0
- package/src/primitives/message/index.ts +8 -0
- package/src/primitives/suggestion/SuggestionDescription.tsx +16 -0
- package/src/primitives/suggestion/SuggestionTitle.tsx +16 -0
- package/src/primitives/suggestion/SuggestionTrigger.tsx +64 -0
- package/src/primitives/suggestion/index.ts +12 -0
- package/src/primitives/thread/ThreadIf.tsx +2 -2
- package/src/primitives/thread/ThreadSuggestion.tsx +66 -0
- package/src/primitives/thread/index.ts +12 -0
- package/src/primitives/threadList/ThreadListItems.tsx +2 -2
- package/src/primitives/threadListItem/ThreadListItemArchive.tsx +24 -0
- package/src/primitives/threadListItem/ThreadListItemDelete.tsx +24 -0
- package/src/primitives/threadListItem/ThreadListItemRoot.tsx +13 -0
- package/src/primitives/threadListItem/ThreadListItemTrigger.tsx +24 -0
- package/src/primitives/threadListItem/ThreadListItemUnarchive.tsx +24 -0
- package/src/primitives/threadListItem/index.ts +21 -0
- package/src/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +14 -4
- package/src/runtimes/useLocalRuntime.ts +7 -2
- package/src/runtimes/useRemoteThreadListRuntime.ts +20 -4
- package/src/types/index.ts +23 -0
- package/src/types/scopes/index.ts +59 -0
- package/dist/hooks/index.d.ts +0 -6
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -6
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useComposer.d.ts +0 -4
- package/dist/hooks/useComposer.d.ts.map +0 -1
- package/dist/hooks/useComposer.js +0 -5
- package/dist/hooks/useComposer.js.map +0 -1
- package/dist/hooks/useContentPart.d.ts +0 -2
- package/dist/hooks/useContentPart.d.ts.map +0 -1
- package/dist/hooks/useContentPart.js +0 -5
- package/dist/hooks/useContentPart.js.map +0 -1
- package/dist/hooks/useMessage.d.ts +0 -4
- package/dist/hooks/useMessage.d.ts.map +0 -1
- package/dist/hooks/useMessage.js +0 -5
- package/dist/hooks/useMessage.js.map +0 -1
- package/dist/hooks/useThread.d.ts +0 -4
- package/dist/hooks/useThread.d.ts.map +0 -1
- package/dist/hooks/useThread.js +0 -5
- package/dist/hooks/useThread.js.map +0 -1
- package/dist/hooks/useThreadList.d.ts +0 -4
- package/dist/hooks/useThreadList.d.ts.map +0 -1
- package/dist/hooks/useThreadList.js +0 -5
- package/dist/hooks/useThreadList.js.map +0 -1
- package/dist/runtimes/runtime-adapter.d.ts +0 -3
- package/dist/runtimes/runtime-adapter.d.ts.map +0 -1
- package/dist/runtimes/runtime-adapter.js +0 -44
- package/dist/runtimes/runtime-adapter.js.map +0 -1
- package/src/hooks/index.ts +0 -5
- package/src/hooks/useComposer.ts +0 -14
- package/src/hooks/useContentPart.ts +0 -5
- package/src/hooks/useMessage.ts +0 -14
- package/src/hooks/useThread.ts +0 -14
- package/src/hooks/useThreadList.ts +0 -14
- package/src/runtimes/runtime-adapter.ts +0 -63
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { useAui
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
AssistantRuntimeCore,
|
|
6
|
-
} from "@assistant-ui/core";
|
|
7
|
-
import { RuntimeAdapter } from "../runtimes/runtime-adapter";
|
|
1
|
+
import { type ReactNode, memo } from "react";
|
|
2
|
+
import { useAui } from "@assistant-ui/store";
|
|
3
|
+
import type { AssistantRuntime } from "@assistant-ui/core";
|
|
4
|
+
import { AssistantProviderBase } from "@assistant-ui/core/react";
|
|
8
5
|
|
|
9
6
|
export const useAssistantRuntime = (): AssistantRuntime => {
|
|
10
7
|
const aui = useAui();
|
|
@@ -17,12 +14,6 @@ export const useAssistantRuntime = (): AssistantRuntime => {
|
|
|
17
14
|
return runtime;
|
|
18
15
|
};
|
|
19
16
|
|
|
20
|
-
const getRenderComponent = (runtime: AssistantRuntime) => {
|
|
21
|
-
return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent as
|
|
22
|
-
| ComponentType
|
|
23
|
-
| undefined;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
17
|
export const AssistantProvider = memo(
|
|
27
18
|
({
|
|
28
19
|
runtime,
|
|
@@ -31,14 +22,10 @@ export const AssistantProvider = memo(
|
|
|
31
22
|
runtime: AssistantRuntime;
|
|
32
23
|
children: ReactNode;
|
|
33
24
|
}) => {
|
|
34
|
-
const aui = useAui({ threads: RuntimeAdapter(runtime) }, { parent: null });
|
|
35
|
-
const RenderComponent = getRenderComponent(runtime);
|
|
36
|
-
|
|
37
25
|
return (
|
|
38
|
-
<
|
|
39
|
-
{RenderComponent && <RenderComponent />}
|
|
26
|
+
<AssistantProviderBase runtime={runtime}>
|
|
40
27
|
{children}
|
|
41
|
-
</
|
|
28
|
+
</AssistantProviderBase>
|
|
42
29
|
);
|
|
43
30
|
},
|
|
44
31
|
);
|
|
@@ -2,9 +2,11 @@ import { createContext, FC, ReactNode, useContext } from "react";
|
|
|
2
2
|
import type {
|
|
3
3
|
ThreadHistoryAdapter,
|
|
4
4
|
AttachmentAdapter,
|
|
5
|
+
ModelContextProvider,
|
|
5
6
|
} from "@assistant-ui/core";
|
|
6
7
|
|
|
7
8
|
export type RuntimeAdapters = {
|
|
9
|
+
modelContext?: ModelContextProvider | undefined;
|
|
8
10
|
history?: ThreadHistoryAdapter | undefined;
|
|
9
11
|
attachments?: AttachmentAdapter | undefined;
|
|
10
12
|
};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { useAui, AuiProvider } from "@assistant-ui/store";
|
|
3
|
-
import type { ThreadListItemRuntime } from "@assistant-ui/core";
|
|
4
|
-
import { ThreadListItemClient } from "@assistant-ui/core/store/internal";
|
|
5
|
-
|
|
6
|
-
export const ThreadListItemRuntimeProvider: FC<
|
|
7
|
-
PropsWithChildren<{
|
|
8
|
-
runtime: ThreadListItemRuntime;
|
|
9
|
-
}>
|
|
10
|
-
> = ({ runtime, children }) => {
|
|
11
|
-
const aui = useAui({
|
|
12
|
-
threadListItem: ThreadListItemClient({ runtime }),
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
16
|
-
};
|
|
1
|
+
export { ThreadListItemRuntimeProvider } from "@assistant-ui/core/react";
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "@assistant-ui/core/react"; // store-augmentation side-effect (tools, dataRenderers scopes)
|
|
2
|
+
|
|
1
3
|
// Re-export core types
|
|
2
4
|
export type {
|
|
3
5
|
// Message types
|
|
@@ -38,11 +40,31 @@ export type {
|
|
|
38
40
|
// Attachment types
|
|
39
41
|
Attachment,
|
|
40
42
|
PendingAttachment,
|
|
43
|
+
CreateAttachment,
|
|
41
44
|
AttachmentRuntime,
|
|
45
|
+
// Adapter types
|
|
46
|
+
AttachmentAdapter,
|
|
47
|
+
ThreadHistoryAdapter,
|
|
48
|
+
FeedbackAdapter,
|
|
49
|
+
SuggestionAdapter,
|
|
42
50
|
// Other
|
|
43
51
|
Unsubscribe,
|
|
44
52
|
} from "@assistant-ui/core";
|
|
45
53
|
|
|
54
|
+
// Re-export core remote thread list types
|
|
55
|
+
export type {
|
|
56
|
+
RemoteThreadListAdapter,
|
|
57
|
+
RemoteThreadListOptions,
|
|
58
|
+
} from "@assistant-ui/core";
|
|
59
|
+
export { InMemoryThreadListAdapter } from "@assistant-ui/core";
|
|
60
|
+
|
|
61
|
+
// Attachment adapter implementations
|
|
62
|
+
export {
|
|
63
|
+
SimpleImageAttachmentAdapter,
|
|
64
|
+
SimpleTextAttachmentAdapter,
|
|
65
|
+
CompositeAttachmentAdapter,
|
|
66
|
+
} from "@assistant-ui/core";
|
|
67
|
+
|
|
46
68
|
// Re-export store scope state types
|
|
47
69
|
export type {
|
|
48
70
|
ThreadState,
|
|
@@ -53,26 +75,25 @@ export type {
|
|
|
53
75
|
ThreadListItemState,
|
|
54
76
|
} from "@assistant-ui/core/store";
|
|
55
77
|
|
|
56
|
-
// Store hooks
|
|
78
|
+
// Store hooks and components
|
|
57
79
|
export {
|
|
58
80
|
useAui,
|
|
59
81
|
useAuiState,
|
|
60
82
|
useAuiEvent,
|
|
61
83
|
AuiProvider,
|
|
84
|
+
AuiIf,
|
|
85
|
+
type AssistantClient,
|
|
86
|
+
type AssistantState,
|
|
87
|
+
type AssistantEventScope,
|
|
88
|
+
type AssistantEventSelector,
|
|
89
|
+
type AssistantEventName,
|
|
90
|
+
type AssistantEventPayload,
|
|
91
|
+
type AssistantEventCallback,
|
|
62
92
|
} from "@assistant-ui/store";
|
|
63
93
|
|
|
64
94
|
// Context providers and hooks
|
|
65
95
|
export { AssistantProvider, useAssistantRuntime } from "./context";
|
|
66
96
|
|
|
67
|
-
// State hooks
|
|
68
|
-
export {
|
|
69
|
-
useThread,
|
|
70
|
-
useMessage,
|
|
71
|
-
useComposer,
|
|
72
|
-
useContentPart,
|
|
73
|
-
useThreadList,
|
|
74
|
-
} from "./hooks";
|
|
75
|
-
|
|
76
97
|
// Primitive hooks
|
|
77
98
|
export {
|
|
78
99
|
useThreadMessages,
|
|
@@ -90,6 +111,7 @@ export {
|
|
|
90
111
|
useActionBarFeedbackNegative,
|
|
91
112
|
useEditComposerSend,
|
|
92
113
|
useEditComposerCancel,
|
|
114
|
+
useComposerAddAttachment,
|
|
93
115
|
} from "./primitive-hooks";
|
|
94
116
|
|
|
95
117
|
// Runtime
|
|
@@ -99,13 +121,6 @@ export {
|
|
|
99
121
|
useRemoteThreadListRuntime,
|
|
100
122
|
} from "./runtimes";
|
|
101
123
|
|
|
102
|
-
// Re-export core remote thread list types
|
|
103
|
-
export type {
|
|
104
|
-
RemoteThreadListAdapter,
|
|
105
|
-
RemoteThreadListOptions,
|
|
106
|
-
} from "@assistant-ui/core";
|
|
107
|
-
export { InMemoryThreadListAdapter } from "@assistant-ui/core";
|
|
108
|
-
|
|
109
124
|
// Primitives
|
|
110
125
|
export * from "./primitives/thread";
|
|
111
126
|
export * from "./primitives/composer";
|
|
@@ -113,6 +128,26 @@ export * from "./primitives/message";
|
|
|
113
128
|
export * from "./primitives/threadList";
|
|
114
129
|
export * from "./primitives/actionBar";
|
|
115
130
|
export * from "./primitives/branchPicker";
|
|
131
|
+
export * from "./primitives/attachment";
|
|
132
|
+
export * from "./primitives/threadListItem";
|
|
133
|
+
export * from "./primitives/chainOfThought";
|
|
134
|
+
export * from "./primitives/suggestion";
|
|
135
|
+
|
|
136
|
+
// Re-export shared providers from core/react
|
|
137
|
+
export {
|
|
138
|
+
ThreadListItemByIndexProvider,
|
|
139
|
+
ChainOfThoughtByIndicesProvider,
|
|
140
|
+
MessageByIndexProvider,
|
|
141
|
+
PartByIndexProvider,
|
|
142
|
+
TextMessagePartProvider,
|
|
143
|
+
ChainOfThoughtPartByIndexProvider,
|
|
144
|
+
SuggestionByIndexProvider,
|
|
145
|
+
} from "@assistant-ui/core/react";
|
|
146
|
+
|
|
147
|
+
// Model context, tools & clients
|
|
148
|
+
export * from "./model-context";
|
|
149
|
+
export * from "./client";
|
|
150
|
+
export * from "./types";
|
|
116
151
|
|
|
117
152
|
// Adapters
|
|
118
153
|
export {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Re-export shared from core/react
|
|
2
|
+
export {
|
|
3
|
+
makeAssistantTool,
|
|
4
|
+
type AssistantTool,
|
|
5
|
+
makeAssistantToolUI,
|
|
6
|
+
type AssistantToolUI,
|
|
7
|
+
makeAssistantDataUI,
|
|
8
|
+
type AssistantDataUI,
|
|
9
|
+
useAssistantTool,
|
|
10
|
+
type AssistantToolProps,
|
|
11
|
+
useAssistantToolUI,
|
|
12
|
+
type AssistantToolUIProps,
|
|
13
|
+
useAssistantDataUI,
|
|
14
|
+
type AssistantDataUIProps,
|
|
15
|
+
useAssistantInstructions,
|
|
16
|
+
useInlineRender,
|
|
17
|
+
type Toolkit,
|
|
18
|
+
type ToolDefinition,
|
|
19
|
+
Tools,
|
|
20
|
+
DataRenderers,
|
|
21
|
+
} from "@assistant-ui/core/react";
|
|
22
|
+
|
|
23
|
+
// Core pass-through (unchanged)
|
|
24
|
+
export type {
|
|
25
|
+
ModelContext,
|
|
26
|
+
ModelContextProvider,
|
|
27
|
+
LanguageModelConfig,
|
|
28
|
+
LanguageModelV1CallSettings,
|
|
29
|
+
} from "@assistant-ui/core";
|
|
30
|
+
|
|
31
|
+
export { mergeModelContexts } from "@assistant-ui/core";
|
|
32
|
+
|
|
33
|
+
export type { Tool } from "assistant-stream";
|
|
34
|
+
|
|
35
|
+
export { tool } from "@assistant-ui/core";
|
|
36
|
+
|
|
37
|
+
export { Suggestions, type SuggestionConfig } from "@assistant-ui/core/store";
|
|
38
|
+
|
|
39
|
+
export { ModelContextRegistry } from "@assistant-ui/core";
|
|
40
|
+
export type {
|
|
41
|
+
ModelContextRegistryToolHandle,
|
|
42
|
+
ModelContextRegistryInstructionHandle,
|
|
43
|
+
ModelContextRegistryProviderHandle,
|
|
44
|
+
} from "@assistant-ui/core";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useAui } from "@assistant-ui/store";
|
|
3
|
+
import type { CreateAttachment } from "@assistant-ui/core";
|
|
4
|
+
|
|
5
|
+
export const useComposerAddAttachment = () => {
|
|
6
|
+
const aui = useAui();
|
|
7
|
+
|
|
8
|
+
const addAttachment = useCallback(
|
|
9
|
+
(file: File | CreateAttachment) => {
|
|
10
|
+
return aui.composer().addAttachment(file);
|
|
11
|
+
},
|
|
12
|
+
[aui],
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return { addAttachment };
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import { Text, type TextProps } from "react-native";
|
|
3
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
4
|
+
|
|
5
|
+
export type AttachmentNameProps = TextProps;
|
|
6
|
+
|
|
7
|
+
export const AttachmentName: FC<AttachmentNameProps> = (props) => {
|
|
8
|
+
const name = useAuiState((s) => s.attachment.name);
|
|
9
|
+
return <Text {...props}>{name}</Text>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useAui } from "@assistant-ui/store";
|
|
5
|
+
|
|
6
|
+
export type AttachmentRemoveProps = Omit<PressableProps, "onPress"> & {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const AttachmentRemove = ({
|
|
11
|
+
children,
|
|
12
|
+
...pressableProps
|
|
13
|
+
}: AttachmentRemoveProps) => {
|
|
14
|
+
const aui = useAui();
|
|
15
|
+
|
|
16
|
+
const handleRemove = useCallback(() => {
|
|
17
|
+
aui.attachment().remove();
|
|
18
|
+
}, [aui]);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Pressable onPress={handleRemove} {...pressableProps}>
|
|
22
|
+
{children}
|
|
23
|
+
</Pressable>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { View, type ViewProps } from "react-native";
|
|
3
|
+
|
|
4
|
+
export type AttachmentRootProps = ViewProps & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const AttachmentRoot = ({
|
|
9
|
+
children,
|
|
10
|
+
...viewProps
|
|
11
|
+
}: AttachmentRootProps) => {
|
|
12
|
+
return <View {...viewProps}>{children}</View>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import { Text, type TextProps } from "react-native";
|
|
3
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
4
|
+
|
|
5
|
+
export type AttachmentThumbProps = TextProps;
|
|
6
|
+
|
|
7
|
+
export const AttachmentThumb: FC<AttachmentThumbProps> = (props) => {
|
|
8
|
+
const ext = useAuiState((s) => {
|
|
9
|
+
const parts = s.attachment.name.split(".");
|
|
10
|
+
return parts.length > 1 ? parts.pop()! : "";
|
|
11
|
+
});
|
|
12
|
+
return <Text {...props}>.{ext}</Text>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AttachmentRoot, type AttachmentRootProps } from "./AttachmentRoot";
|
|
2
|
+
export { AttachmentName, type AttachmentNameProps } from "./AttachmentName";
|
|
3
|
+
export { AttachmentThumb, type AttachmentThumbProps } from "./AttachmentThumb";
|
|
4
|
+
export {
|
|
5
|
+
AttachmentRemove,
|
|
6
|
+
type AttachmentRemoveProps,
|
|
7
|
+
} from "./AttachmentRemove";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useCallback, type ReactNode } from "react";
|
|
2
|
+
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
4
|
+
|
|
5
|
+
export type ChainOfThoughtAccordionTriggerProps = Omit<
|
|
6
|
+
PressableProps,
|
|
7
|
+
"onPress"
|
|
8
|
+
> & {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const ChainOfThoughtAccordionTrigger = ({
|
|
13
|
+
children,
|
|
14
|
+
...pressableProps
|
|
15
|
+
}: ChainOfThoughtAccordionTriggerProps) => {
|
|
16
|
+
const aui = useAui();
|
|
17
|
+
const collapsed = useAuiState((s) => s.chainOfThought.collapsed);
|
|
18
|
+
|
|
19
|
+
const onPress = useCallback(() => {
|
|
20
|
+
aui.chainOfThought().setCollapsed(!collapsed);
|
|
21
|
+
}, [aui, collapsed]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Pressable onPress={onPress} {...pressableProps}>
|
|
25
|
+
{children}
|
|
26
|
+
</Pressable>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { View, type ViewProps } from "react-native";
|
|
3
|
+
|
|
4
|
+
export type ChainOfThoughtRootProps = ViewProps & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const ChainOfThoughtRoot = ({
|
|
9
|
+
children,
|
|
10
|
+
...viewProps
|
|
11
|
+
}: ChainOfThoughtRootProps) => {
|
|
12
|
+
return <View {...viewProps}>{children}</View>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ChainOfThoughtRoot,
|
|
3
|
+
type ChainOfThoughtRootProps,
|
|
4
|
+
} from "./ChainOfThoughtRoot";
|
|
5
|
+
export {
|
|
6
|
+
ChainOfThoughtAccordionTrigger,
|
|
7
|
+
type ChainOfThoughtAccordionTriggerProps,
|
|
8
|
+
} from "./ChainOfThoughtAccordionTrigger";
|
|
9
|
+
export { ChainOfThoughtPrimitiveParts } from "@assistant-ui/core/react";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
+
import { useComposerAddAttachment } from "../../primitive-hooks/useComposerAddAttachment";
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
|
+
|
|
6
|
+
export type ComposerAddAttachmentProps = Omit<PressableProps, "onPress"> & {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A button that triggers the attachment adding flow.
|
|
12
|
+
*
|
|
13
|
+
* Note: The actual file picker implementation is platform-specific.
|
|
14
|
+
* This component calls `useComposerAddAttachment()` from your primitive-hooks.
|
|
15
|
+
* You must handle the file selection in your own component using the returned `addAttachment` callback.
|
|
16
|
+
*/
|
|
17
|
+
export const ComposerAddAttachment = ({
|
|
18
|
+
children,
|
|
19
|
+
disabled: disabledProp,
|
|
20
|
+
...pressableProps
|
|
21
|
+
}: ComposerAddAttachmentProps) => {
|
|
22
|
+
const isDisabled = useAuiState((s) => !s.composer.isEditing);
|
|
23
|
+
const { addAttachment: _addAttachment } = useComposerAddAttachment();
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Pressable disabled={disabledProp ?? isDisabled} {...pressableProps}>
|
|
27
|
+
{children}
|
|
28
|
+
</Pressable>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ComposerPrimitiveAttachments,
|
|
4
|
+
ComposerPrimitiveAttachmentByIndex,
|
|
5
|
+
} from "@assistant-ui/core/react";
|
|
6
|
+
|
|
7
|
+
export type AttachmentComponents = {
|
|
8
|
+
Image?: ComponentType | undefined;
|
|
9
|
+
Document?: ComponentType | undefined;
|
|
10
|
+
File?: ComponentType | undefined;
|
|
11
|
+
Attachment?: ComponentType | undefined;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ComposerAttachmentsProps = {
|
|
15
|
+
components: AttachmentComponents | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ComposerAttachmentByIndexProps = {
|
|
19
|
+
index: number;
|
|
20
|
+
components?: AttachmentComponents | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const ComposerAttachmentByIndex = ComposerPrimitiveAttachmentByIndex;
|
|
24
|
+
|
|
25
|
+
export const ComposerAttachments = ComposerPrimitiveAttachments;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ComposerPrimitiveIf as ComposerIf } from "@assistant-ui/core/react";
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export { ComposerRoot, type ComposerRootProps } from "./ComposerRoot";
|
|
2
|
+
export {
|
|
3
|
+
ComposerAttachments,
|
|
4
|
+
ComposerAttachmentByIndex,
|
|
5
|
+
} from "./ComposerAttachments";
|
|
2
6
|
export { ComposerInput, type ComposerInputProps } from "./ComposerInput";
|
|
3
7
|
export { ComposerSend, type ComposerSendProps } from "./ComposerSend";
|
|
4
8
|
export { ComposerCancel, type ComposerCancelProps } from "./ComposerCancel";
|
|
9
|
+
export {
|
|
10
|
+
ComposerAddAttachment,
|
|
11
|
+
type ComposerAddAttachmentProps,
|
|
12
|
+
} from "./ComposerAddAttachment";
|
|
13
|
+
export { ComposerIf } from "./ComposerIf";
|
|
5
14
|
export {
|
|
6
15
|
EditComposerInput,
|
|
7
16
|
type EditComposerInputProps,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MessagePrimitiveAttachments,
|
|
3
|
+
MessagePrimitiveAttachmentByIndex,
|
|
4
|
+
} from "@assistant-ui/core/react";
|
|
5
|
+
import type { AttachmentComponents } from "../composer/ComposerAttachments";
|
|
6
|
+
|
|
7
|
+
export type MessageAttachmentsProps = {
|
|
8
|
+
components: AttachmentComponents | undefined;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type MessageAttachmentByIndexProps = {
|
|
12
|
+
index: number;
|
|
13
|
+
components?: AttachmentComponents | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const MessageAttachmentByIndex = MessagePrimitiveAttachmentByIndex;
|
|
17
|
+
|
|
18
|
+
export const MessageAttachments = MessagePrimitiveAttachments;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { type ReactElement, Fragment } from "react";
|
|
1
|
+
import { type ReactElement, Fragment, useMemo } from "react";
|
|
2
2
|
import { Text } from "react-native";
|
|
3
3
|
import type {
|
|
4
4
|
ThreadUserMessagePart,
|
|
5
5
|
ThreadAssistantMessagePart,
|
|
6
|
+
ToolCallMessagePart,
|
|
7
|
+
DataMessagePart,
|
|
6
8
|
} from "@assistant-ui/core";
|
|
7
|
-
import {
|
|
9
|
+
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
10
|
+
import type {
|
|
11
|
+
ToolCallMessagePartProps,
|
|
12
|
+
DataMessagePartProps,
|
|
13
|
+
} from "../../types";
|
|
8
14
|
|
|
9
15
|
type MessageContentPart = ThreadUserMessagePart | ThreadAssistantMessagePart;
|
|
10
16
|
|
|
@@ -47,6 +53,63 @@ const DefaultTextRenderer = ({
|
|
|
47
53
|
return <Text>{part.text}</Text>;
|
|
48
54
|
};
|
|
49
55
|
|
|
56
|
+
const ToolUIDisplay = ({
|
|
57
|
+
Fallback,
|
|
58
|
+
part,
|
|
59
|
+
index,
|
|
60
|
+
}: {
|
|
61
|
+
Fallback:
|
|
62
|
+
| ((props: { part: ToolCallMessagePart; index: number }) => ReactElement)
|
|
63
|
+
| undefined;
|
|
64
|
+
part: ToolCallMessagePart;
|
|
65
|
+
index: number;
|
|
66
|
+
}) => {
|
|
67
|
+
const aui = useAui();
|
|
68
|
+
const Render = useAuiState((s) => {
|
|
69
|
+
const renders = s.tools.tools[part.toolName];
|
|
70
|
+
if (Array.isArray(renders)) return renders[0];
|
|
71
|
+
return renders;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const partMethods = useMemo(
|
|
75
|
+
() => aui.message().part({ index }),
|
|
76
|
+
[aui, index],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
if (Render) {
|
|
80
|
+
return (
|
|
81
|
+
<Render
|
|
82
|
+
{...(part as ToolCallMessagePartProps)}
|
|
83
|
+
addResult={partMethods.addToolResult}
|
|
84
|
+
resume={partMethods.resumeToolCall}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
if (Fallback) return <Fallback part={part} index={index} />;
|
|
89
|
+
return null;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const DataUIDisplay = ({
|
|
93
|
+
Fallback,
|
|
94
|
+
part,
|
|
95
|
+
index,
|
|
96
|
+
}: {
|
|
97
|
+
Fallback:
|
|
98
|
+
| ((props: { part: DataMessagePart; index: number }) => ReactElement)
|
|
99
|
+
| undefined;
|
|
100
|
+
part: DataMessagePart;
|
|
101
|
+
index: number;
|
|
102
|
+
}) => {
|
|
103
|
+
const Render = useAuiState((s) => {
|
|
104
|
+
const renders = s.dataRenderers.renderers[part.name];
|
|
105
|
+
if (Array.isArray(renders)) return renders[0];
|
|
106
|
+
return renders;
|
|
107
|
+
});
|
|
108
|
+
if (Render) return <Render {...(part as DataMessagePartProps)} />;
|
|
109
|
+
if (Fallback) return <Fallback part={part} index={index} />;
|
|
110
|
+
return null;
|
|
111
|
+
};
|
|
112
|
+
|
|
50
113
|
export const MessageContent = ({
|
|
51
114
|
renderText,
|
|
52
115
|
renderToolCall,
|
|
@@ -56,7 +119,7 @@ export const MessageContent = ({
|
|
|
56
119
|
renderFile,
|
|
57
120
|
renderData,
|
|
58
121
|
}: MessageContentProps) => {
|
|
59
|
-
const content =
|
|
122
|
+
const content = useAuiState((s) => s.message.content);
|
|
60
123
|
|
|
61
124
|
return (
|
|
62
125
|
<>
|
|
@@ -74,9 +137,14 @@ export const MessageContent = ({
|
|
|
74
137
|
</Fragment>
|
|
75
138
|
);
|
|
76
139
|
case "tool-call":
|
|
77
|
-
if (!renderToolCall) return null;
|
|
78
140
|
return (
|
|
79
|
-
<Fragment key={key}>
|
|
141
|
+
<Fragment key={key}>
|
|
142
|
+
<ToolUIDisplay
|
|
143
|
+
Fallback={renderToolCall}
|
|
144
|
+
part={part}
|
|
145
|
+
index={index}
|
|
146
|
+
/>
|
|
147
|
+
</Fragment>
|
|
80
148
|
);
|
|
81
149
|
case "image":
|
|
82
150
|
if (!renderImage) return null;
|
|
@@ -97,8 +165,15 @@ export const MessageContent = ({
|
|
|
97
165
|
if (!renderFile) return null;
|
|
98
166
|
return <Fragment key={key}>{renderFile({ part, index })}</Fragment>;
|
|
99
167
|
case "data":
|
|
100
|
-
|
|
101
|
-
|
|
168
|
+
return (
|
|
169
|
+
<Fragment key={key}>
|
|
170
|
+
<DataUIDisplay
|
|
171
|
+
Fallback={renderData}
|
|
172
|
+
part={part}
|
|
173
|
+
index={index}
|
|
174
|
+
/>
|
|
175
|
+
</Fragment>
|
|
176
|
+
);
|
|
102
177
|
default:
|
|
103
178
|
return null;
|
|
104
179
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
3
3
|
|
|
4
4
|
export type MessageIfProps = {
|
|
5
5
|
children: ReactNode;
|
|
@@ -16,7 +16,7 @@ export const MessageIf = ({
|
|
|
16
16
|
running,
|
|
17
17
|
last,
|
|
18
18
|
}: MessageIfProps) => {
|
|
19
|
-
const message =
|
|
19
|
+
const message = useAuiState((s) => s.message);
|
|
20
20
|
|
|
21
21
|
if (user !== undefined) {
|
|
22
22
|
if (user !== (message.role === "user")) return null;
|