@assistant-ui/react 0.12.11 → 0.12.14
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/README.md +68 -58
- package/dist/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +25 -13
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/client/InMemoryThreadList.js +1 -2
- package/dist/client/InMemoryThreadList.js.map +1 -1
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.d.ts +1 -7
- package/dist/context/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.js +1 -22
- package/dist/context/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.d.ts +1 -5
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js +1 -19
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts +1 -4
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.js +1 -12
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.d.ts +1 -4
- package/dist/context/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.js +1 -17
- package/dist/context/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/context/providers/PartByIndexProvider.d.ts +1 -4
- package/dist/context/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/PartByIndexProvider.js +1 -12
- package/dist/context/providers/PartByIndexProvider.js.map +1 -1
- package/dist/context/providers/SuggestionByIndexProvider.d.ts +1 -5
- package/dist/context/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/SuggestionByIndexProvider.js +1 -12
- package/dist/context/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.d.ts +1 -5
- package/dist/context/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.js +1 -25
- package/dist/context/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.d.ts +1 -9
- package/dist/context/providers/ThreadListItemProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.js +1 -19
- package/dist/context/providers/ThreadListItemProvider.js.map +1 -1
- package/dist/context/providers/index.d.ts +1 -0
- package/dist/context/providers/index.d.ts.map +1 -1
- package/dist/context/providers/index.js +1 -0
- package/dist/context/providers/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +8 -9
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.d.ts +1 -2
- package/dist/legacy-runtime/RuntimeAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.js +1 -48
- package/dist/legacy-runtime/RuntimeAdapter.js.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js +135 -27
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +280 -112
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/index.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +22 -0
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +17 -13
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +8 -6
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.js +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +14 -4
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/model-context/index.d.ts +4 -13
- package/dist/model-context/index.d.ts.map +1 -1
- package/dist/model-context/index.js +6 -11
- package/dist/model-context/index.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js.map +1 -1
- package/dist/primitives/actionBarMore/scope.d.ts +1 -1
- package/dist/primitives/actionBarMore/scope.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/scope.js +1 -1
- package/dist/primitives/actionBarMore/scope.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
- package/dist/primitives/assistantModal/scope.d.ts +1 -1
- package/dist/primitives/assistantModal/scope.d.ts.map +1 -1
- package/dist/primitives/assistantModal/scope.js +1 -1
- package/dist/primitives/assistantModal/scope.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts +1 -38
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js +1 -38
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.js +2 -2
- package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.d.ts +1 -36
- package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +1 -61
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerIf.d.ts +2 -17
- package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerIf.js +1 -23
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +2 -2
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.d.ts +1 -36
- package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +1 -65
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageIf.d.ts +1 -1
- package/dist/primitives/message/MessageIf.js +1 -1
- package/dist/primitives/message/MessageParts.d.ts +5 -219
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js +29 -270
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.js +2 -2
- package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.d.ts +3 -0
- package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +4 -1
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.d.ts +1 -1
- package/dist/primitives/thread/ThreadIf.js +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts +1 -94
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +1 -109
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestions.d.ts +1 -52
- package/dist/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestions.js +1 -56
- package/dist/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/primitives/thread/ThreadViewportSlack.js +2 -2
- package/dist/primitives/thread/ThreadViewportSlack.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.d.ts +1 -34
- package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +1 -35
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts +1 -7
- package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -7
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js.map +1 -1
- package/dist/primitives/threadListItemMore/scope.d.ts +1 -1
- package/dist/primitives/threadListItemMore/scope.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/scope.js +1 -1
- package/dist/primitives/threadListItemMore/scope.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/scopes/index.d.ts +1 -2
- package/dist/types/scopes/index.d.ts.map +1 -1
- package/package.json +10 -12
- package/src/client/ExternalThread.ts +25 -13
- package/src/client/InMemoryThreadList.ts +1 -2
- package/src/client/index.ts +3 -2
- package/src/context/providers/AttachmentByIndexProvider.tsx +4 -34
- package/src/context/providers/ChainOfThoughtByIndicesProvider.tsx +1 -34
- package/src/context/providers/ChainOfThoughtPartByIndexProvider.tsx +1 -18
- package/src/context/providers/MessageByIndexProvider.tsx +1 -23
- package/src/context/providers/PartByIndexProvider.tsx +1 -18
- package/src/context/providers/SuggestionByIndexProvider.tsx +4 -21
- package/src/context/providers/TextMessagePartProvider.tsx +1 -46
- package/src/context/providers/ThreadListItemProvider.tsx +4 -33
- package/src/context/providers/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +13 -21
- package/src/legacy-runtime/RuntimeAdapter.ts +1 -66
- package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.ts +179 -40
- package/src/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.ts +1 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/index.ts +1 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +25 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +22 -13
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.test.ts +6 -3
- package/src/legacy-runtime/runtime-cores/external-store/external-message-converter.ts +19 -21
- package/src/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.ts +1 -0
- package/src/legacy-runtime/runtime-cores/external-store/index.ts +1 -0
- package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts +20 -4
- package/src/model-context/index.ts +29 -22
- package/src/primitives/actionBarMore/ActionBarMoreContent.tsx +1 -1
- package/src/primitives/actionBarMore/ActionBarMoreItem.tsx +1 -1
- package/src/primitives/actionBarMore/ActionBarMoreRoot.tsx +1 -1
- package/src/primitives/actionBarMore/ActionBarMoreSeparator.tsx +1 -1
- package/src/primitives/actionBarMore/ActionBarMoreTrigger.tsx +1 -1
- package/src/primitives/actionBarMore/scope.ts +1 -1
- package/src/primitives/assistantModal/AssistantModalAnchor.tsx +1 -1
- package/src/primitives/assistantModal/AssistantModalContent.tsx +1 -1
- package/src/primitives/assistantModal/AssistantModalRoot.tsx +1 -1
- package/src/primitives/assistantModal/AssistantModalTrigger.tsx +1 -1
- package/src/primitives/assistantModal/scope.ts +1 -1
- package/src/primitives/chainOfThought/ChainOfThoughtParts.tsx +1 -85
- package/src/primitives/composer/ComposerAttachmentDropzone.tsx +2 -2
- package/src/primitives/composer/ComposerAttachments.tsx +4 -110
- package/src/primitives/composer/ComposerIf.ts +2 -42
- package/src/primitives/composer/ComposerInput.tsx +2 -2
- package/src/primitives/message/MessageAttachments.tsx +4 -113
- package/src/primitives/message/MessageIf.ts +1 -1
- package/src/primitives/message/MessageParts.tsx +43 -642
- package/src/primitives/message/MessagePartsGrouped.tsx +3 -3
- package/src/primitives/thread/ThreadEmpty.ts +4 -3
- package/src/primitives/thread/ThreadIf.ts +1 -1
- package/src/primitives/thread/ThreadMessages.tsx +4 -217
- package/src/primitives/thread/ThreadSuggestions.tsx +4 -106
- package/src/primitives/thread/ThreadViewportSlack.tsx +2 -2
- package/src/primitives/threadList/ThreadListItems.tsx +4 -79
- package/src/primitives/threadListItem/ThreadListItemTitle.test.tsx +7 -3
- package/src/primitives/threadListItem/ThreadListItemTitle.tsx +1 -17
- package/src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx +1 -1
- package/src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx +1 -1
- package/src/primitives/threadListItemMore/ThreadListItemMoreRoot.tsx +1 -1
- package/src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx +1 -1
- package/src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx +1 -1
- package/src/primitives/threadListItemMore/scope.ts +1 -1
- package/src/tests/BaseComposerRuntimeCore.test.ts +106 -1
- package/src/tests/DataRenderers.test.ts +1 -2
- package/src/types/index.ts +3 -2
- package/src/types/scopes/index.ts +5 -3
- package/dist/client/DataRenderers.d.ts +0 -3
- package/dist/client/DataRenderers.d.ts.map +0 -1
- package/dist/client/DataRenderers.js +0 -33
- package/dist/client/DataRenderers.js.map +0 -1
- package/dist/client/Tools.d.ts +0 -8
- package/dist/client/Tools.d.ts.map +0 -1
- package/dist/client/Tools.js +0 -68
- package/dist/client/Tools.js.map +0 -1
- package/dist/model-context/makeAssistantDataUI.d.ts +0 -7
- package/dist/model-context/makeAssistantDataUI.d.ts.map +0 -1
- package/dist/model-context/makeAssistantDataUI.js +0 -11
- package/dist/model-context/makeAssistantDataUI.js.map +0 -1
- package/dist/model-context/makeAssistantTool.d.ts +0 -7
- package/dist/model-context/makeAssistantTool.d.ts.map +0 -1
- package/dist/model-context/makeAssistantTool.js +0 -11
- package/dist/model-context/makeAssistantTool.js.map +0 -1
- package/dist/model-context/makeAssistantToolUI.d.ts +0 -7
- package/dist/model-context/makeAssistantToolUI.d.ts.map +0 -1
- package/dist/model-context/makeAssistantToolUI.js +0 -11
- package/dist/model-context/makeAssistantToolUI.js.map +0 -1
- package/dist/model-context/toolbox.d.ts +0 -10
- package/dist/model-context/toolbox.d.ts.map +0 -1
- package/dist/model-context/toolbox.js +0 -3
- package/dist/model-context/toolbox.js.map +0 -1
- package/dist/model-context/useAssistantDataUI.d.ts +0 -7
- package/dist/model-context/useAssistantDataUI.d.ts.map +0 -1
- package/dist/model-context/useAssistantDataUI.js +0 -12
- package/dist/model-context/useAssistantDataUI.js.map +0 -1
- package/dist/model-context/useAssistantInstructions.d.ts +0 -4
- package/dist/model-context/useAssistantInstructions.d.ts.map +0 -1
- package/dist/model-context/useAssistantInstructions.js +0 -23
- package/dist/model-context/useAssistantInstructions.js.map +0 -1
- package/dist/model-context/useAssistantTool.d.ts +0 -7
- package/dist/model-context/useAssistantTool.d.ts.map +0 -1
- package/dist/model-context/useAssistantTool.js +0 -23
- package/dist/model-context/useAssistantTool.js.map +0 -1
- package/dist/model-context/useAssistantToolUI.d.ts +0 -7
- package/dist/model-context/useAssistantToolUI.d.ts.map +0 -1
- package/dist/model-context/useAssistantToolUI.js +0 -12
- package/dist/model-context/useAssistantToolUI.js.map +0 -1
- package/dist/model-context/useInlineRender.d.ts +0 -4
- package/dist/model-context/useInlineRender.d.ts.map +0 -1
- package/dist/model-context/useInlineRender.js +0 -16
- package/dist/model-context/useInlineRender.js.map +0 -1
- package/dist/types/MessagePartComponentTypes.d.ts +0 -33
- package/dist/types/MessagePartComponentTypes.d.ts.map +0 -1
- package/dist/types/MessagePartComponentTypes.js +0 -2
- package/dist/types/MessagePartComponentTypes.js.map +0 -1
- package/dist/types/scopes/dataRenderers.d.ts +0 -13
- package/dist/types/scopes/dataRenderers.d.ts.map +0 -1
- package/dist/types/scopes/dataRenderers.js +0 -2
- package/dist/types/scopes/dataRenderers.js.map +0 -1
- package/dist/types/scopes/tools.d.ts +0 -13
- package/dist/types/scopes/tools.d.ts.map +0 -1
- package/dist/types/scopes/tools.js +0 -2
- package/dist/types/scopes/tools.js.map +0 -1
- package/dist/types/store-augmentation.d.ts +0 -10
- package/dist/types/store-augmentation.d.ts.map +0 -1
- package/dist/types/store-augmentation.js +0 -2
- package/dist/types/store-augmentation.js.map +0 -1
- package/src/client/DataRenderers.ts +0 -42
- package/src/client/Tools.ts +0 -97
- package/src/model-context/makeAssistantDataUI.ts +0 -22
- package/src/model-context/makeAssistantTool.ts +0 -22
- package/src/model-context/makeAssistantToolUI.ts +0 -22
- package/src/model-context/toolbox.ts +0 -17
- package/src/model-context/useAssistantDataUI.ts +0 -18
- package/src/model-context/useAssistantInstructions.ts +0 -32
- package/src/model-context/useAssistantTool.ts +0 -39
- package/src/model-context/useAssistantToolUI.ts +0 -20
- package/src/model-context/useInlineRender.ts +0 -27
- package/src/types/MessagePartComponentTypes.ts +0 -66
- package/src/types/scopes/dataRenderers.ts +0 -15
- package/src/types/scopes/tools.ts +0 -18
- package/src/types/store-augmentation.ts +0 -11
|
@@ -1,38 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// Re-export shared from core/react
|
|
2
4
|
export {
|
|
3
|
-
|
|
5
|
+
makeAssistantTool,
|
|
6
|
+
type AssistantTool,
|
|
4
7
|
makeAssistantToolUI,
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
type AssistantDataUI,
|
|
8
|
+
type AssistantToolUI,
|
|
8
9
|
makeAssistantDataUI,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export {
|
|
10
|
+
type AssistantDataUI,
|
|
11
|
+
useAssistantTool,
|
|
12
|
+
type AssistantToolProps,
|
|
13
13
|
useAssistantToolUI,
|
|
14
14
|
type AssistantToolUIProps,
|
|
15
|
-
} from "./useAssistantToolUI";
|
|
16
|
-
export {
|
|
17
15
|
useAssistantDataUI,
|
|
18
16
|
type AssistantDataUIProps,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
useAssistantInstructions,
|
|
18
|
+
useInlineRender,
|
|
19
|
+
type Toolkit,
|
|
20
|
+
type ToolDefinition,
|
|
21
|
+
Tools,
|
|
22
|
+
DataRenderers,
|
|
23
|
+
} from "@assistant-ui/core/react";
|
|
24
|
+
|
|
25
|
+
// Core pass-through (unchanged)
|
|
26
|
+
export type {
|
|
27
|
+
ModelContext,
|
|
28
|
+
ModelContextProvider,
|
|
29
|
+
LanguageModelConfig,
|
|
30
|
+
LanguageModelV1CallSettings,
|
|
31
|
+
} from "@assistant-ui/core";
|
|
32
|
+
|
|
33
|
+
export { mergeModelContexts } from "@assistant-ui/core";
|
|
23
34
|
|
|
24
35
|
export type { Tool } from "assistant-stream";
|
|
25
36
|
|
|
26
37
|
export { tool } from "@assistant-ui/core";
|
|
27
38
|
|
|
28
|
-
export { makeAssistantVisible } from "./makeAssistantVisible";
|
|
29
|
-
|
|
30
|
-
export type { Toolkit, ToolDefinition } from "./toolbox";
|
|
31
|
-
|
|
32
|
-
export { Tools } from "../client/Tools";
|
|
33
|
-
export { DataRenderers } from "../client/DataRenderers";
|
|
34
|
-
|
|
35
39
|
export { Suggestions, type SuggestionConfig } from "@assistant-ui/core/store";
|
|
36
40
|
|
|
41
|
+
// React-only (stays)
|
|
42
|
+
export { makeAssistantVisible } from "./makeAssistantVisible";
|
|
43
|
+
|
|
37
44
|
export * from "./registry";
|
|
38
45
|
export * from "./frame";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
-
import
|
|
4
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
5
5
|
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
6
|
|
|
7
7
|
export namespace ActionBarMorePrimitiveContent {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
-
import
|
|
4
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
5
5
|
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
6
|
|
|
7
7
|
export namespace ActionBarMorePrimitiveItem {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
import
|
|
4
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
5
5
|
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
6
|
|
|
7
7
|
export namespace ActionBarMorePrimitiveRoot {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
-
import
|
|
4
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
5
5
|
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
6
|
|
|
7
7
|
export namespace ActionBarMorePrimitiveSeparator {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
-
import
|
|
4
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
5
5
|
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
6
|
|
|
7
7
|
export namespace ActionBarMorePrimitiveTrigger {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
-
import
|
|
4
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
5
5
|
import { ScopedProps, usePopoverScope } from "./scope";
|
|
6
6
|
|
|
7
7
|
export namespace AssistantModalPrimitiveAnchor {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
-
import
|
|
4
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
5
5
|
import { ScopedProps, usePopoverScope } from "./scope";
|
|
6
6
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { FC, useEffect, useState } from "react";
|
|
4
|
-
import
|
|
4
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
5
5
|
import { ScopedProps, usePopoverScope } from "./scope";
|
|
6
6
|
import { useAui } from "@assistant-ui/store";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
3
3
|
import { ScopedProps, usePopoverScope } from "./scope";
|
|
4
4
|
|
|
5
5
|
export namespace AssistantModalPrimitiveTrigger {
|
|
@@ -1,87 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
type ComponentType,
|
|
5
|
-
type FC,
|
|
6
|
-
type PropsWithChildren,
|
|
7
|
-
useMemo,
|
|
8
|
-
} from "react";
|
|
9
|
-
import { useAuiState } from "@assistant-ui/store";
|
|
10
|
-
import { ChainOfThoughtPartByIndexProvider } from "../../context/providers/ChainOfThoughtPartByIndexProvider";
|
|
11
|
-
import { MessagePartComponent } from "../message/MessageParts";
|
|
12
|
-
import type {
|
|
13
|
-
ReasoningMessagePartComponent,
|
|
14
|
-
ToolCallMessagePartComponent,
|
|
15
|
-
} from "../../types/MessagePartComponentTypes";
|
|
16
|
-
|
|
17
|
-
export namespace ChainOfThoughtPrimitiveParts {
|
|
18
|
-
export type Props = {
|
|
19
|
-
/**
|
|
20
|
-
* Component configuration for rendering chain of thought parts.
|
|
21
|
-
*/
|
|
22
|
-
components?: {
|
|
23
|
-
/** Component for rendering reasoning parts */
|
|
24
|
-
Reasoning?: ReasoningMessagePartComponent | undefined;
|
|
25
|
-
/** Fallback component for tool-call parts */
|
|
26
|
-
tools?: {
|
|
27
|
-
Fallback?: ToolCallMessagePartComponent | undefined;
|
|
28
|
-
};
|
|
29
|
-
/** Layout component to wrap the rendered parts when expanded */
|
|
30
|
-
Layout?: ComponentType<PropsWithChildren> | undefined;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Renders the parts within a chain of thought, with support for collapsed/expanded states.
|
|
37
|
-
*
|
|
38
|
-
* When collapsed, no parts are shown. When expanded, all parts are rendered
|
|
39
|
-
* using the provided component configuration through the part scope mechanism.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```tsx
|
|
43
|
-
* <ChainOfThoughtPrimitive.Parts
|
|
44
|
-
* components={{
|
|
45
|
-
* Reasoning: ({ text }) => <p className="reasoning">{text}</p>,
|
|
46
|
-
* tools: {
|
|
47
|
-
* Fallback: ({ toolName }) => <div>Tool: {toolName}</div>
|
|
48
|
-
* }
|
|
49
|
-
* }}
|
|
50
|
-
* />
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export const ChainOfThoughtPrimitiveParts: FC<
|
|
54
|
-
ChainOfThoughtPrimitiveParts.Props
|
|
55
|
-
> = ({ components }) => {
|
|
56
|
-
const partsLength = useAuiState((s) => s.chainOfThought.parts.length);
|
|
57
|
-
|
|
58
|
-
const messageComponents = useMemo(
|
|
59
|
-
() => ({
|
|
60
|
-
Reasoning: components?.Reasoning,
|
|
61
|
-
tools: {
|
|
62
|
-
Fallback: components?.tools?.Fallback,
|
|
63
|
-
},
|
|
64
|
-
}),
|
|
65
|
-
[components?.Reasoning, components?.tools?.Fallback],
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const Layout = components?.Layout;
|
|
69
|
-
|
|
70
|
-
const elements = useMemo(() => {
|
|
71
|
-
return Array.from({ length: partsLength }, (_, index) => (
|
|
72
|
-
<ChainOfThoughtPartByIndexProvider key={index} index={index}>
|
|
73
|
-
{Layout ? (
|
|
74
|
-
<Layout>
|
|
75
|
-
<MessagePartComponent components={messageComponents} />
|
|
76
|
-
</Layout>
|
|
77
|
-
) : (
|
|
78
|
-
<MessagePartComponent components={messageComponents} />
|
|
79
|
-
)}
|
|
80
|
-
</ChainOfThoughtPartByIndexProvider>
|
|
81
|
-
));
|
|
82
|
-
}, [partsLength, messageComponents, Layout]);
|
|
83
|
-
|
|
84
|
-
return <>{elements}</>;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
ChainOfThoughtPrimitiveParts.displayName = "ChainOfThoughtPrimitive.Parts";
|
|
3
|
+
export { ChainOfThoughtPrimitiveParts } from "@assistant-ui/core/react";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useCallback, useState } from "react";
|
|
4
4
|
|
|
5
|
-
import { Slot } from "
|
|
5
|
+
import { Slot } from "radix-ui";
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { useAui } from "@assistant-ui/store";
|
|
8
8
|
|
|
@@ -75,7 +75,7 @@ export const ComposerPrimitiveAttachmentDropzone = forwardRef<
|
|
|
75
75
|
onDropCapture: handleDrop,
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const Comp = asChild ? Slot : "div";
|
|
78
|
+
const Comp = asChild ? Slot.Root : "div";
|
|
79
79
|
|
|
80
80
|
return (
|
|
81
81
|
<Comp
|
|
@@ -1,112 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export namespace ComposerPrimitiveAttachments {
|
|
9
|
-
export type Props = {
|
|
10
|
-
components:
|
|
11
|
-
| {
|
|
12
|
-
Image?: ComponentType | undefined;
|
|
13
|
-
Document?: ComponentType | undefined;
|
|
14
|
-
File?: ComponentType | undefined;
|
|
15
|
-
Attachment?: ComponentType | undefined;
|
|
16
|
-
}
|
|
17
|
-
| undefined;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const getComponent = (
|
|
22
|
-
components: ComposerPrimitiveAttachments.Props["components"],
|
|
23
|
-
attachment: Attachment,
|
|
24
|
-
) => {
|
|
25
|
-
const type = attachment.type;
|
|
26
|
-
switch (type) {
|
|
27
|
-
case "image":
|
|
28
|
-
return components?.Image ?? components?.Attachment;
|
|
29
|
-
case "document":
|
|
30
|
-
return components?.Document ?? components?.Attachment;
|
|
31
|
-
case "file":
|
|
32
|
-
return components?.File ?? components?.Attachment;
|
|
33
|
-
default:
|
|
34
|
-
const _exhaustiveCheck: never = type;
|
|
35
|
-
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const AttachmentComponent: FC<{
|
|
40
|
-
components: ComposerPrimitiveAttachments.Props["components"];
|
|
41
|
-
}> = ({ components }) => {
|
|
42
|
-
const attachment = useAuiState((s) => s.attachment);
|
|
43
|
-
if (!attachment) return null;
|
|
44
|
-
|
|
45
|
-
const Component = getComponent(components, attachment);
|
|
46
|
-
if (!Component) return null;
|
|
47
|
-
return <Component />;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export namespace ComposerPrimitiveAttachmentByIndex {
|
|
51
|
-
export type Props = {
|
|
52
|
-
index: number;
|
|
53
|
-
components?: ComposerPrimitiveAttachments.Props["components"];
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Renders a single attachment at the specified index within the composer.
|
|
59
|
-
*
|
|
60
|
-
* This component provides direct access to render a specific attachment
|
|
61
|
-
* from the composer's attachment list using the provided component configuration.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* <ComposerPrimitive.AttachmentByIndex
|
|
66
|
-
* index={0}
|
|
67
|
-
* components={{
|
|
68
|
-
* Image: MyImageAttachment,
|
|
69
|
-
* Document: MyDocumentAttachment
|
|
70
|
-
* }}
|
|
71
|
-
* />
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export const ComposerPrimitiveAttachmentByIndex: FC<ComposerPrimitiveAttachmentByIndex.Props> =
|
|
75
|
-
memo(
|
|
76
|
-
({ index, components }) => {
|
|
77
|
-
return (
|
|
78
|
-
<ComposerAttachmentByIndexProvider index={index}>
|
|
79
|
-
<AttachmentComponent components={components} />
|
|
80
|
-
</ComposerAttachmentByIndexProvider>
|
|
81
|
-
);
|
|
82
|
-
},
|
|
83
|
-
(prev, next) =>
|
|
84
|
-
prev.index === next.index &&
|
|
85
|
-
prev.components?.Image === next.components?.Image &&
|
|
86
|
-
prev.components?.Document === next.components?.Document &&
|
|
87
|
-
prev.components?.File === next.components?.File &&
|
|
88
|
-
prev.components?.Attachment === next.components?.Attachment,
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
ComposerPrimitiveAttachmentByIndex.displayName =
|
|
92
|
-
"ComposerPrimitive.AttachmentByIndex";
|
|
93
|
-
|
|
94
|
-
export const ComposerPrimitiveAttachments: FC<
|
|
95
|
-
ComposerPrimitiveAttachments.Props
|
|
96
|
-
> = ({ components }) => {
|
|
97
|
-
const attachmentsCount = useAuiState((s) => s.composer.attachments.length);
|
|
98
|
-
|
|
99
|
-
const attachmentElements = useMemo(() => {
|
|
100
|
-
return Array.from({ length: attachmentsCount }, (_, index) => (
|
|
101
|
-
<ComposerPrimitiveAttachmentByIndex
|
|
102
|
-
key={index}
|
|
103
|
-
index={index}
|
|
104
|
-
components={components}
|
|
105
|
-
/>
|
|
106
|
-
));
|
|
107
|
-
}, [attachmentsCount, components]);
|
|
108
|
-
|
|
109
|
-
return attachmentElements;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
ComposerPrimitiveAttachments.displayName = "ComposerPrimitive.Attachments";
|
|
3
|
+
export {
|
|
4
|
+
ComposerPrimitiveAttachments,
|
|
5
|
+
ComposerPrimitiveAttachmentByIndex,
|
|
6
|
+
} from "@assistant-ui/core/react";
|
|
@@ -1,44 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { RequireAtLeastOne } from "../../utils/RequireAtLeastOne";
|
|
6
|
-
|
|
7
|
-
type ComposerIfFilters = {
|
|
8
|
-
/** Whether the composer is in editing mode */
|
|
9
|
-
editing: boolean | undefined;
|
|
10
|
-
/** Whether dictation is currently active */
|
|
11
|
-
dictation: boolean | undefined;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type UseComposerIfProps = RequireAtLeastOne<ComposerIfFilters>;
|
|
15
|
-
|
|
16
|
-
const useComposerIf = (props: UseComposerIfProps) => {
|
|
17
|
-
return useAuiState((s) => {
|
|
18
|
-
if (props.editing === true && !s.composer.isEditing) return false;
|
|
19
|
-
if (props.editing === false && s.composer.isEditing) return false;
|
|
20
|
-
|
|
21
|
-
const isDictating = s.composer.dictation != null;
|
|
22
|
-
if (props.dictation === true && !isDictating) return false;
|
|
23
|
-
if (props.dictation === false && isDictating) return false;
|
|
24
|
-
|
|
25
|
-
return true;
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export namespace ComposerPrimitiveIf {
|
|
30
|
-
export type Props = PropsWithChildren<UseComposerIfProps>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Use `<AuiIf condition={({ composer }) => ...} />` instead.
|
|
35
|
-
*/
|
|
36
|
-
export const ComposerPrimitiveIf: FC<ComposerPrimitiveIf.Props> = ({
|
|
37
|
-
children,
|
|
38
|
-
...query
|
|
39
|
-
}) => {
|
|
40
|
-
const result = useComposerIf(query);
|
|
41
|
-
return result ? children : null;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
ComposerPrimitiveIf.displayName = "ComposerPrimitive.If";
|
|
3
|
+
export { ComposerPrimitiveIf } from "@assistant-ui/core/react";
|
|
4
|
+
export type { UseComposerIfProps } from "@assistant-ui/core/react";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
4
4
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
5
|
-
import { Slot } from "
|
|
5
|
+
import { Slot } from "radix-ui";
|
|
6
6
|
import {
|
|
7
7
|
ClipboardEvent,
|
|
8
8
|
type KeyboardEvent,
|
|
@@ -139,7 +139,7 @@ export const ComposerPrimitiveInput = forwardRef<
|
|
|
139
139
|
return s.composer.text;
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
-
const Component = asChild ? Slot : TextareaAutosize;
|
|
142
|
+
const Component = asChild ? Slot.Root : TextareaAutosize;
|
|
143
143
|
|
|
144
144
|
const isDisabled =
|
|
145
145
|
useAuiState(
|
|
@@ -1,115 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export namespace MessagePrimitiveAttachments {
|
|
9
|
-
export type Props = {
|
|
10
|
-
components:
|
|
11
|
-
| {
|
|
12
|
-
Image?: ComponentType | undefined;
|
|
13
|
-
Document?: ComponentType | undefined;
|
|
14
|
-
File?: ComponentType | undefined;
|
|
15
|
-
Attachment?: ComponentType | undefined;
|
|
16
|
-
}
|
|
17
|
-
| undefined;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const getComponent = (
|
|
22
|
-
components: MessagePrimitiveAttachments.Props["components"],
|
|
23
|
-
attachment: CompleteAttachment,
|
|
24
|
-
) => {
|
|
25
|
-
const type = attachment.type;
|
|
26
|
-
switch (type) {
|
|
27
|
-
case "image":
|
|
28
|
-
return components?.Image ?? components?.Attachment;
|
|
29
|
-
case "document":
|
|
30
|
-
return components?.Document ?? components?.Attachment;
|
|
31
|
-
case "file":
|
|
32
|
-
return components?.File ?? components?.Attachment;
|
|
33
|
-
default:
|
|
34
|
-
const _exhaustiveCheck: never = type;
|
|
35
|
-
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const AttachmentComponent: FC<{
|
|
40
|
-
components: MessagePrimitiveAttachments.Props["components"];
|
|
41
|
-
}> = ({ components }) => {
|
|
42
|
-
const attachment = useAuiState((s) => s.attachment);
|
|
43
|
-
if (!attachment) return null;
|
|
44
|
-
|
|
45
|
-
const Component = getComponent(components, attachment as CompleteAttachment);
|
|
46
|
-
if (!Component) return null;
|
|
47
|
-
return <Component />;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export namespace MessagePrimitiveAttachmentByIndex {
|
|
51
|
-
export type Props = {
|
|
52
|
-
index: number;
|
|
53
|
-
components?: MessagePrimitiveAttachments.Props["components"];
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Renders a single attachment at the specified index within the current message.
|
|
59
|
-
*
|
|
60
|
-
* This component provides direct access to render a specific attachment
|
|
61
|
-
* from the message's attachment list using the provided component configuration.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* <MessagePrimitive.AttachmentByIndex
|
|
66
|
-
* index={0}
|
|
67
|
-
* components={{
|
|
68
|
-
* Image: MyImageAttachment,
|
|
69
|
-
* Document: MyDocumentAttachment
|
|
70
|
-
* }}
|
|
71
|
-
* />
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export const MessagePrimitiveAttachmentByIndex: FC<MessagePrimitiveAttachmentByIndex.Props> =
|
|
75
|
-
memo(
|
|
76
|
-
({ index, components }) => {
|
|
77
|
-
return (
|
|
78
|
-
<MessageAttachmentByIndexProvider index={index}>
|
|
79
|
-
<AttachmentComponent components={components} />
|
|
80
|
-
</MessageAttachmentByIndexProvider>
|
|
81
|
-
);
|
|
82
|
-
},
|
|
83
|
-
(prev, next) =>
|
|
84
|
-
prev.index === next.index &&
|
|
85
|
-
prev.components?.Image === next.components?.Image &&
|
|
86
|
-
prev.components?.Document === next.components?.Document &&
|
|
87
|
-
prev.components?.File === next.components?.File &&
|
|
88
|
-
prev.components?.Attachment === next.components?.Attachment,
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
MessagePrimitiveAttachmentByIndex.displayName =
|
|
92
|
-
"MessagePrimitive.AttachmentByIndex";
|
|
93
|
-
|
|
94
|
-
export const MessagePrimitiveAttachments: FC<
|
|
95
|
-
MessagePrimitiveAttachments.Props
|
|
96
|
-
> = ({ components }) => {
|
|
97
|
-
const attachmentsCount = useAuiState((s) => {
|
|
98
|
-
if (s.message.role !== "user") return 0;
|
|
99
|
-
return s.message.attachments.length;
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const attachmentElements = useMemo(() => {
|
|
103
|
-
return Array.from({ length: attachmentsCount }, (_, index) => (
|
|
104
|
-
<MessagePrimitiveAttachmentByIndex
|
|
105
|
-
key={index}
|
|
106
|
-
index={index}
|
|
107
|
-
components={components}
|
|
108
|
-
/>
|
|
109
|
-
));
|
|
110
|
-
}, [attachmentsCount, components]);
|
|
111
|
-
|
|
112
|
-
return attachmentElements;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
|
|
3
|
+
export {
|
|
4
|
+
MessagePrimitiveAttachments,
|
|
5
|
+
MessagePrimitiveAttachmentByIndex,
|
|
6
|
+
} from "@assistant-ui/core/react";
|
|
@@ -78,7 +78,7 @@ export namespace MessagePrimitiveIf {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* @deprecated Use `<AuiIf condition={(
|
|
81
|
+
* @deprecated Use `<AuiIf condition={(s) => s.message...} />` instead.
|
|
82
82
|
*/
|
|
83
83
|
export const MessagePrimitiveIf: FC<MessagePrimitiveIf.Props> = ({
|
|
84
84
|
children,
|