@assistant-ui/react 0.11.58 → 0.12.0
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/dist/client/ModelContextClient.d.ts +2 -6
- package/dist/client/ModelContextClient.d.ts.map +1 -1
- package/dist/client/ModelContextClient.js +13 -10
- package/dist/client/ModelContextClient.js.map +1 -1
- package/dist/client/NoOpComposerClient.d.ts +4 -6
- package/dist/client/NoOpComposerClient.d.ts.map +1 -1
- package/dist/client/NoOpComposerClient.js +42 -40
- package/dist/client/NoOpComposerClient.js.map +1 -1
- package/dist/client/ThreadMessageClient.d.ts +2 -6
- package/dist/client/ThreadMessageClient.d.ts.map +1 -1
- package/dist/client/ThreadMessageClient.js +87 -81
- package/dist/client/ThreadMessageClient.js.map +1 -1
- package/dist/client/Tools.d.ts +4 -6
- package/dist/client/Tools.d.ts.map +1 -1
- package/dist/client/Tools.js +33 -31
- package/dist/client/Tools.js.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.js +9 -12
- package/dist/context/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.js +7 -22
- package/dist/context/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/context/providers/MessageProvider.d.ts.map +1 -1
- package/dist/context/providers/MessageProvider.js +4 -13
- package/dist/context/providers/MessageProvider.js.map +1 -1
- package/dist/context/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/PartByIndexProvider.js +5 -7
- package/dist/context/providers/PartByIndexProvider.js.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.js +16 -22
- package/dist/context/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.js +9 -35
- package/dist/context/providers/ThreadListItemProvider.js.map +1 -1
- package/dist/context/react/index.d.ts +0 -4
- package/dist/context/react/index.d.ts.map +1 -1
- package/dist/context/react/index.js +0 -6
- package/dist/context/react/index.js.map +1 -1
- package/dist/devtools/DevToolsHooks.d.ts +3 -3
- package/dist/devtools/DevToolsHooks.d.ts.map +1 -1
- package/dist/devtools/DevToolsHooks.js +5 -5
- package/dist/devtools/DevToolsHooks.js.map +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +3 -3
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.d.ts +1 -5
- package/dist/legacy-runtime/RuntimeAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.js +25 -4
- package/dist/legacy-runtime/RuntimeAdapter.js.map +1 -1
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.d.ts +4 -6
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.js +8 -8
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts +6 -6
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js +38 -37
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.d.ts +4 -6
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.js +9 -12
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/MessageRuntimeClient.d.ts +5 -6
- package/dist/legacy-runtime/client/MessageRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/MessageRuntimeClient.js +38 -44
- package/dist/legacy-runtime/client/MessageRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.d.ts +4 -6
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.js +23 -23
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.d.ts +5 -6
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.js +30 -31
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadRuntimeClient.d.ts +4 -6
- package/dist/legacy-runtime/client/ThreadRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadRuntimeClient.js +40 -42
- package/dist/legacy-runtime/client/ThreadRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js +13 -13
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.d.ts +8 -0
- package/dist/legacy-runtime/cloud/auiV0.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.js +14 -0
- package/dist/legacy-runtime/cloud/auiV0.js.map +1 -1
- package/dist/legacy-runtime/hooks/AssistantContext.d.ts +4 -4
- package/dist/legacy-runtime/hooks/AssistantContext.js +4 -4
- package/dist/legacy-runtime/hooks/AssistantContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +14 -14
- package/dist/legacy-runtime/hooks/AttachmentContext.js +5 -5
- package/dist/legacy-runtime/hooks/AttachmentContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/ComposerContext.d.ts +10 -10
- package/dist/legacy-runtime/hooks/ComposerContext.js +8 -8
- package/dist/legacy-runtime/hooks/ComposerContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/MessageContext.d.ts +9 -9
- package/dist/legacy-runtime/hooks/MessageContext.js +9 -9
- package/dist/legacy-runtime/hooks/MessageContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/MessagePartContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/MessagePartContext.js +4 -4
- package/dist/legacy-runtime/hooks/MessagePartContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts +8 -8
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/ThreadContext.js +8 -8
- package/dist/legacy-runtime/hooks/ThreadContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/ThreadListItemContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/ThreadListItemContext.js +5 -5
- package/dist/legacy-runtime/hooks/ThreadListItemContext.js.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts +1 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.js +3 -3
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.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 +5 -5
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js +15 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.js +1 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js +2 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.js +2 -5
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js +5 -5
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js +7 -2
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js +5 -5
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js +9 -8
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +3 -3
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +4 -4
- package/dist/model-context/makeAssistantVisible.js.map +1 -1
- package/dist/model-context/useAssistantInstructions.js +4 -4
- package/dist/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/model-context/useAssistantTool.js +6 -6
- package/dist/model-context/useAssistantTool.js.map +1 -1
- package/dist/model-context/useAssistantToolUI.js +4 -4
- package/dist/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +10 -10
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js +5 -5
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js +5 -5
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +5 -5
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +5 -5
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js +5 -5
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.js +5 -5
- package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +5 -5
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +2 -2
- package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +4 -4
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/attachment/AttachmentName.js +2 -2
- package/dist/primitives/attachment/AttachmentName.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +4 -4
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js +2 -2
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js +2 -2
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +5 -5
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js +2 -2
- package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +5 -5
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +6 -6
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.js +4 -4
- package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +4 -3
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +5 -5
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerDictate.js +5 -5
- package/dist/primitives/composer/ComposerDictate.js.map +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.js +2 -2
- package/dist/primitives/composer/ComposerDictationTranscript.js.map +1 -1
- package/dist/primitives/composer/ComposerIf.d.ts +1 -1
- package/dist/primitives/composer/ComposerIf.js +3 -3
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +19 -19
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +5 -5
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.js +6 -5
- package/dist/primitives/composer/ComposerStopDictation.js.map +1 -1
- package/dist/primitives/error/ErrorMessage.js +2 -2
- package/dist/primitives/error/ErrorMessage.js.map +1 -1
- package/dist/primitives/index.d.ts +0 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +0 -1
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +4 -3
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageError.js +2 -2
- package/dist/primitives/message/MessageError.js.map +1 -1
- package/dist/primitives/message/MessageIf.d.ts +1 -1
- package/dist/primitives/message/MessageIf.js +3 -3
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js +10 -9
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.js +10 -9
- package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
- package/dist/primitives/message/MessageRoot.js +4 -4
- package/dist/primitives/message/MessageRoot.js.map +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.js +2 -2
- package/dist/primitives/messagePart/MessagePartInProgress.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.js +2 -2
- package/dist/primitives/messagePart/useMessagePartData.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.js +2 -2
- package/dist/primitives/messagePart/useMessagePartFile.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.js +2 -2
- package/dist/primitives/messagePart/useMessagePartImage.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.js +2 -2
- package/dist/primitives/messagePart/useMessagePartReasoning.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.js +2 -2
- package/dist/primitives/messagePart/useMessagePartSource.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.js +2 -2
- package/dist/primitives/messagePart/useMessagePartText.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +2 -2
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.d.ts +1 -1
- package/dist/primitives/thread/ThreadIf.js +3 -3
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +5 -4
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js +10 -10
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/thread/ThreadViewportSlack.js +2 -2
- package/dist/primitives/thread/ThreadViewportSlack.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +4 -4
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +3 -2
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +4 -4
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +4 -4
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +4 -4
- package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +4 -4
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +4 -4
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/scopes/attachment.d.ts +22 -0
- package/dist/types/scopes/attachment.d.ts.map +1 -0
- package/dist/types/scopes/attachment.js +2 -0
- package/dist/types/scopes/attachment.js.map +1 -0
- package/dist/{client/types/Composer.d.ts → types/scopes/composer.d.ts} +29 -9
- package/dist/types/scopes/composer.d.ts.map +1 -0
- package/dist/types/scopes/composer.js +2 -0
- package/dist/types/scopes/composer.js.map +1 -0
- package/dist/types/scopes/index.d.ts +10 -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/dist/{client/types/Message.d.ts → types/scopes/message.d.ts} +35 -27
- package/dist/types/scopes/message.d.ts.map +1 -0
- package/dist/types/scopes/message.js +2 -0
- package/dist/types/scopes/message.js.map +1 -0
- package/dist/types/scopes/modelContext.d.ts +12 -0
- package/dist/types/scopes/modelContext.d.ts.map +1 -0
- package/dist/types/scopes/modelContext.js +2 -0
- package/dist/types/scopes/modelContext.js.map +1 -0
- package/dist/types/scopes/part.d.ts +37 -0
- package/dist/types/scopes/part.d.ts.map +1 -0
- package/dist/types/scopes/part.js +2 -0
- package/dist/types/scopes/part.js.map +1 -0
- package/dist/{client/types/Thread.d.ts → types/scopes/thread.d.ts} +45 -25
- package/dist/types/scopes/thread.d.ts.map +1 -0
- package/dist/types/scopes/thread.js +2 -0
- package/dist/types/scopes/thread.js.map +1 -0
- package/dist/types/scopes/threadListItem.d.ts +50 -0
- package/dist/types/scopes/threadListItem.d.ts.map +1 -0
- package/dist/types/scopes/threadListItem.js +2 -0
- package/dist/types/scopes/threadListItem.js.map +1 -0
- package/dist/types/scopes/threads.d.ts +28 -0
- package/dist/types/scopes/threads.d.ts.map +1 -0
- package/dist/types/scopes/threads.js +2 -0
- package/dist/types/scopes/threads.js.map +1 -0
- package/dist/types/scopes/tools.d.ts +14 -0
- package/dist/types/scopes/tools.d.ts.map +1 -0
- package/dist/types/scopes/tools.js +2 -0
- package/dist/types/scopes/tools.js.map +1 -0
- package/dist/types/store-augmentation.d.ts +24 -0
- package/dist/types/store-augmentation.d.ts.map +1 -0
- package/dist/types/store-augmentation.js +2 -0
- package/dist/types/store-augmentation.js.map +1 -0
- package/dist/utils/smooth/SmoothContext.js +3 -3
- package/dist/utils/smooth/SmoothContext.js.map +1 -1
- package/dist/utils/smooth/useSmooth.js +2 -2
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.js +2 -2
- package/dist/utils/useToolArgsFieldStatus.js.map +1 -1
- package/package.json +3 -2
- package/src/client/ModelContextClient.ts +19 -12
- package/src/client/NoOpComposerClient.tsx +45 -42
- package/src/client/ThreadMessageClient.tsx +99 -86
- package/src/client/Tools.ts +73 -62
- package/src/context/providers/AttachmentByIndexProvider.tsx +9 -17
- package/src/context/providers/MessageByIndexProvider.tsx +7 -32
- package/src/context/providers/MessageProvider.tsx +4 -16
- package/src/context/providers/PartByIndexProvider.tsx +5 -11
- package/src/context/providers/TextMessagePartProvider.tsx +24 -32
- package/src/context/providers/ThreadListItemProvider.tsx +9 -45
- package/src/context/react/index.ts +0 -13
- package/src/devtools/DevToolsHooks.ts +7 -7
- package/src/index.ts +42 -0
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +4 -7
- package/src/legacy-runtime/RuntimeAdapter.ts +32 -4
- package/src/legacy-runtime/client/AttachmentRuntimeClient.ts +7 -9
- package/src/legacy-runtime/client/ComposerRuntimeClient.ts +54 -50
- package/src/legacy-runtime/client/MessagePartRuntimeClient.ts +12 -17
- package/src/legacy-runtime/client/MessageRuntimeClient.ts +40 -34
- package/src/legacy-runtime/client/ThreadListItemRuntimeClient.ts +17 -17
- package/src/legacy-runtime/client/ThreadListRuntimeClient.ts +47 -42
- package/src/legacy-runtime/client/ThreadRuntimeClient.ts +52 -49
- package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.tsx +13 -16
- package/src/legacy-runtime/cloud/auiV0.ts +27 -1
- package/src/legacy-runtime/hooks/AssistantContext.ts +7 -7
- package/src/legacy-runtime/hooks/AttachmentContext.ts +7 -7
- package/src/legacy-runtime/hooks/ComposerContext.ts +15 -15
- package/src/legacy-runtime/hooks/MessageContext.ts +14 -14
- package/src/legacy-runtime/hooks/MessagePartContext.ts +6 -6
- package/src/legacy-runtime/hooks/ThreadContext.ts +13 -17
- package/src/legacy-runtime/hooks/ThreadListItemContext.ts +7 -7
- package/src/legacy-runtime/runtime/ThreadListItemRuntime.ts +4 -4
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.tsx +5 -7
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.ts +17 -1
- package/src/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.tsx +1 -1
- package/src/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.tsx +1 -1
- package/src/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.tsx +1 -1
- package/src/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.tsx +3 -3
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.tsx +2 -2
- package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.tsx +4 -6
- package/src/legacy-runtime/runtime-cores/external-store/createMessageConverter.tsx +5 -5
- package/src/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.tsx +6 -2
- package/src/legacy-runtime/runtime-cores/local/useLocalRuntime.tsx +11 -14
- package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +9 -8
- package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.tsx +3 -3
- package/src/model-context/makeAssistantVisible.tsx +4 -4
- package/src/model-context/useAssistantInstructions.tsx +4 -4
- package/src/model-context/useAssistantTool.tsx +6 -6
- package/src/model-context/useAssistantToolUI.tsx +4 -4
- package/src/primitives/actionBar/ActionBarCopy.tsx +10 -10
- package/src/primitives/actionBar/ActionBarEdit.tsx +5 -5
- package/src/primitives/actionBar/ActionBarExportMarkdown.tsx +5 -5
- package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +5 -5
- package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +5 -5
- package/src/primitives/actionBar/ActionBarReload.tsx +5 -5
- package/src/primitives/actionBar/ActionBarSpeak.tsx +5 -5
- package/src/primitives/actionBar/ActionBarStopSpeaking.tsx +5 -5
- package/src/primitives/actionBar/useActionBarFloatStatus.tsx +2 -2
- package/src/primitives/assistantModal/AssistantModalRoot.tsx +4 -4
- package/src/primitives/attachment/AttachmentName.tsx +2 -2
- package/src/primitives/attachment/AttachmentRemove.tsx +4 -4
- package/src/primitives/attachment/AttachmentThumb.tsx +2 -2
- package/src/primitives/branchPicker/BranchPickerCount.tsx +2 -2
- package/src/primitives/branchPicker/BranchPickerNext.tsx +5 -5
- package/src/primitives/branchPicker/BranchPickerNumber.tsx +2 -2
- package/src/primitives/branchPicker/BranchPickerPrevious.tsx +5 -5
- package/src/primitives/composer/ComposerAddAttachment.tsx +6 -6
- package/src/primitives/composer/ComposerAttachmentDropzone.tsx +4 -4
- package/src/primitives/composer/ComposerAttachments.tsx +4 -8
- package/src/primitives/composer/ComposerCancel.tsx +5 -5
- package/src/primitives/composer/ComposerDictate.tsx +5 -5
- package/src/primitives/composer/ComposerDictationTranscript.tsx +2 -2
- package/src/primitives/composer/ComposerIf.tsx +3 -3
- package/src/primitives/composer/ComposerInput.tsx +19 -19
- package/src/primitives/composer/ComposerSend.tsx +5 -5
- package/src/primitives/composer/ComposerStopDictation.tsx +6 -7
- package/src/primitives/error/ErrorMessage.tsx +2 -2
- package/src/primitives/index.ts +0 -2
- package/src/primitives/message/MessageAttachments.tsx +4 -6
- package/src/primitives/message/MessageError.tsx +2 -2
- package/src/primitives/message/MessageIf.tsx +3 -3
- package/src/primitives/message/MessageParts.tsx +10 -13
- package/src/primitives/message/MessagePartsGrouped.tsx +10 -13
- package/src/primitives/message/MessageRoot.tsx +4 -4
- package/src/primitives/messagePart/MessagePartInProgress.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartData.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartFile.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartImage.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartReasoning.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartSource.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartText.tsx +2 -2
- package/src/primitives/thread/ThreadEmpty.tsx +2 -2
- package/src/primitives/thread/ThreadIf.tsx +3 -3
- package/src/primitives/thread/ThreadMessages.tsx +5 -8
- package/src/primitives/thread/ThreadSuggestion.tsx +10 -10
- package/src/primitives/thread/ThreadViewportSlack.tsx +2 -2
- package/src/primitives/thread/useThreadViewportAutoScroll.tsx +4 -4
- package/src/primitives/threadList/ThreadListItems.tsx +3 -5
- package/src/primitives/threadList/ThreadListNew.tsx +4 -4
- package/src/primitives/threadListItem/ThreadListItemArchive.ts +4 -4
- package/src/primitives/threadListItem/ThreadListItemDelete.ts +4 -4
- package/src/primitives/threadListItem/ThreadListItemRoot.tsx +2 -2
- package/src/primitives/threadListItem/ThreadListItemTitle.tsx +2 -2
- package/src/primitives/threadListItem/ThreadListItemTrigger.ts +4 -4
- package/src/primitives/threadListItem/ThreadListItemUnarchive.ts +4 -4
- package/src/types/index.ts +0 -8
- package/src/types/scopes/attachment.ts +22 -0
- package/src/{client/types/Composer.ts → types/scopes/composer.ts} +26 -9
- package/src/types/scopes/index.ts +50 -0
- package/src/{client/types/Message.ts → types/scopes/message.ts} +30 -38
- package/src/types/scopes/modelContext.ts +14 -0
- package/src/{client/types/Part.ts → types/scopes/part.ts} +21 -14
- package/src/{client/types/Thread.ts → types/scopes/thread.ts} +44 -53
- package/src/types/scopes/threadListItem.ts +44 -0
- package/src/{client/types/ThreadList.ts → types/scopes/threads.ts} +17 -17
- package/src/types/scopes/tools.ts +19 -0
- package/src/types/store-augmentation.ts +25 -0
- package/src/utils/smooth/SmoothContext.tsx +3 -3
- package/src/utils/smooth/useSmooth.tsx +2 -2
- package/src/utils/useToolArgsFieldStatus.tsx +2 -2
- package/dist/client/AssistantClient.d.ts +0 -21
- package/dist/client/AssistantClient.d.ts.map +0 -1
- package/dist/client/AssistantClient.js +0 -96
- package/dist/client/AssistantClient.js.map +0 -1
- package/dist/client/EventContext.d.ts +0 -4
- package/dist/client/EventContext.d.ts.map +0 -1
- package/dist/client/EventContext.js +0 -12
- package/dist/client/EventContext.js.map +0 -1
- package/dist/client/ModelContext.d.ts +0 -8
- package/dist/client/ModelContext.d.ts.map +0 -1
- package/dist/client/ModelContext.js +0 -12
- package/dist/client/ModelContext.js.map +0 -1
- package/dist/client/types/Attachment.d.ts +0 -7
- package/dist/client/types/Attachment.d.ts.map +0 -1
- package/dist/client/types/Attachment.js +0 -2
- package/dist/client/types/Attachment.js.map +0 -1
- package/dist/client/types/Composer.d.ts.map +0 -1
- package/dist/client/types/Composer.js +0 -2
- package/dist/client/types/Composer.js.map +0 -1
- package/dist/client/types/Message.d.ts.map +0 -1
- package/dist/client/types/Message.js +0 -2
- package/dist/client/types/Message.js.map +0 -1
- package/dist/client/types/ModelContext.d.ts +0 -12
- package/dist/client/types/ModelContext.d.ts.map +0 -1
- package/dist/client/types/ModelContext.js +0 -2
- package/dist/client/types/ModelContext.js.map +0 -1
- package/dist/client/types/Part.d.ts +0 -22
- package/dist/client/types/Part.d.ts.map +0 -1
- package/dist/client/types/Part.js +0 -2
- package/dist/client/types/Part.js.map +0 -1
- package/dist/client/types/Thread.d.ts.map +0 -1
- package/dist/client/types/Thread.js +0 -2
- package/dist/client/types/Thread.js.map +0 -1
- package/dist/client/types/ThreadList.d.ts +0 -24
- package/dist/client/types/ThreadList.d.ts.map +0 -1
- package/dist/client/types/ThreadList.js +0 -2
- package/dist/client/types/ThreadList.js.map +0 -1
- package/dist/client/types/ThreadListItem.d.ts +0 -23
- package/dist/client/types/ThreadListItem.d.ts.map +0 -1
- package/dist/client/types/ThreadListItem.js +0 -2
- package/dist/client/types/ThreadListItem.js.map +0 -1
- package/dist/client/types/Tools.d.ts +0 -13
- package/dist/client/types/Tools.d.ts.map +0 -1
- package/dist/client/types/Tools.js +0 -2
- package/dist/client/types/Tools.js.map +0 -1
- package/dist/client/util-hooks/tapLookupResources.d.ts +0 -15
- package/dist/client/util-hooks/tapLookupResources.d.ts.map +0 -1
- package/dist/client/util-hooks/tapLookupResources.js +0 -26
- package/dist/client/util-hooks/tapLookupResources.js.map +0 -1
- package/dist/context/react/AssistantApiContext.d.ts +0 -138
- package/dist/context/react/AssistantApiContext.d.ts.map +0 -1
- package/dist/context/react/AssistantApiContext.js +0 -158
- package/dist/context/react/AssistantApiContext.js.map +0 -1
- package/dist/context/react/hooks/useAssistantEvent.d.ts +0 -3
- package/dist/context/react/hooks/useAssistantEvent.d.ts.map +0 -1
- package/dist/context/react/hooks/useAssistantEvent.js +0 -13
- package/dist/context/react/hooks/useAssistantEvent.js.map +0 -1
- package/dist/context/react/hooks/useAssistantState.d.ts +0 -3
- package/dist/context/react/hooks/useAssistantState.d.ts.map +0 -1
- package/dist/context/react/hooks/useAssistantState.js +0 -42
- package/dist/context/react/hooks/useAssistantState.js.map +0 -1
- package/dist/legacy-runtime/client/EventManagerRuntimeClient.d.ts +0 -11
- package/dist/legacy-runtime/client/EventManagerRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/EventManagerRuntimeClient.js +0 -44
- package/dist/legacy-runtime/client/EventManagerRuntimeClient.js.map +0 -1
- package/dist/primitives/assistant/AssistantIf.d.ts +0 -12
- package/dist/primitives/assistant/AssistantIf.d.ts.map +0 -1
- package/dist/primitives/assistant/AssistantIf.js +0 -11
- package/dist/primitives/assistant/AssistantIf.js.map +0 -1
- package/dist/types/EventTypes.d.ts +0 -57
- package/dist/types/EventTypes.d.ts.map +0 -1
- package/dist/types/EventTypes.js +0 -17
- package/dist/types/EventTypes.js.map +0 -1
- package/dist/utils/tap-store/derived-scopes.d.ts +0 -75
- package/dist/utils/tap-store/derived-scopes.d.ts.map +0 -1
- package/dist/utils/tap-store/derived-scopes.js +0 -56
- package/dist/utils/tap-store/derived-scopes.js.map +0 -1
- package/dist/utils/tap-store/index.d.ts +0 -4
- package/dist/utils/tap-store/index.d.ts.map +0 -1
- package/dist/utils/tap-store/index.js +0 -4
- package/dist/utils/tap-store/index.js.map +0 -1
- package/dist/utils/tap-store/store.d.ts +0 -14
- package/dist/utils/tap-store/store.d.ts.map +0 -1
- package/dist/utils/tap-store/store.js +0 -9
- package/dist/utils/tap-store/store.js.map +0 -1
- package/dist/utils/tap-store/tap-api.d.ts +0 -13
- package/dist/utils/tap-store/tap-api.d.ts.map +0 -1
- package/dist/utils/tap-store/tap-api.js +0 -49
- package/dist/utils/tap-store/tap-api.js.map +0 -1
- package/src/client/AssistantClient.ts +0 -175
- package/src/client/EventContext.ts +0 -22
- package/src/client/ModelContext.ts +0 -28
- package/src/client/types/Attachment.ts +0 -13
- package/src/client/types/ModelContext.ts +0 -14
- package/src/client/types/ThreadListItem.ts +0 -26
- package/src/client/types/Tools.ts +0 -19
- package/src/client/util-hooks/tapLookupResources.ts +0 -45
- package/src/context/react/AssistantApiContext.tsx +0 -340
- package/src/context/react/hooks/useAssistantEvent.ts +0 -25
- package/src/context/react/hooks/useAssistantState.tsx +0 -65
- package/src/legacy-runtime/client/EventManagerRuntimeClient.ts +0 -81
- package/src/primitives/assistant/AssistantIf.tsx +0 -25
- package/src/types/EventTypes.ts +0 -103
- package/src/utils/tap-store/derived-scopes.ts +0 -175
- package/src/utils/tap-store/index.ts +0 -10
- package/src/utils/tap-store/store.ts +0 -35
- package/src/utils/tap-store/tap-api.ts +0 -70
package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.tsx
CHANGED
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
ComponentType,
|
|
11
11
|
} from "react";
|
|
12
12
|
import { UseBoundStore, StoreApi, create } from "zustand";
|
|
13
|
-
import {
|
|
13
|
+
import { useAui } from "@assistant-ui/store";
|
|
14
|
+
import { ThreadListItemByIdProvider } from "../../../context/providers";
|
|
14
15
|
import { ThreadRuntimeCore, ThreadRuntimeImpl } from "../../../internal";
|
|
15
16
|
import { BaseSubscribable } from "./BaseSubscribable";
|
|
16
17
|
import { AssistantRuntime } from "../../runtime";
|
|
@@ -103,7 +104,7 @@ export class RemoteThreadListHookInstanceManager extends BaseSubscribable {
|
|
|
103
104
|
return threadBinding.outerSubscribe(updateRuntime);
|
|
104
105
|
}, [threadBinding, updateRuntime]);
|
|
105
106
|
|
|
106
|
-
const
|
|
107
|
+
const aui = useAui();
|
|
107
108
|
const initPromiseRef = useRef<Promise<unknown> | undefined>(undefined);
|
|
108
109
|
|
|
109
110
|
useEffect(() => {
|
|
@@ -112,24 +113,24 @@ export class RemoteThreadListHookInstanceManager extends BaseSubscribable {
|
|
|
112
113
|
"__internal_setGetInitializePromise"
|
|
113
114
|
];
|
|
114
115
|
if (typeof setGetInitializePromise === "function") {
|
|
115
|
-
setGetInitializePromise(() => initPromiseRef.current);
|
|
116
|
+
setGetInitializePromise.call(runtimeCore, () => initPromiseRef.current);
|
|
116
117
|
}
|
|
117
118
|
}, [threadBinding]);
|
|
118
119
|
|
|
119
120
|
useEffect(() => {
|
|
120
121
|
return runtime.threads.main.unstable_on("initialize", () => {
|
|
121
|
-
const state =
|
|
122
|
+
const state = aui.threadListItem().getState();
|
|
122
123
|
if (state.status === "new") {
|
|
123
|
-
initPromiseRef.current =
|
|
124
|
+
initPromiseRef.current = aui.threadListItem().initialize();
|
|
124
125
|
|
|
125
|
-
const dispose = runtime.thread.unstable_on("
|
|
126
|
+
const dispose = runtime.thread.unstable_on("runEnd", () => {
|
|
126
127
|
dispose();
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
aui.threadListItem().generateTitle();
|
|
129
130
|
});
|
|
130
131
|
}
|
|
131
132
|
});
|
|
132
|
-
}, [runtime,
|
|
133
|
+
}, [runtime, aui]);
|
|
133
134
|
|
|
134
135
|
return null;
|
|
135
136
|
};
|
|
@@ -7,7 +7,7 @@ import { RemoteThreadListOptions } from "./types";
|
|
|
7
7
|
import { AssistantRuntimeImpl } from "../../../internal";
|
|
8
8
|
import { AssistantRuntimeCore } from "../core/AssistantRuntimeCore";
|
|
9
9
|
import { AssistantRuntime } from "../../runtime/AssistantRuntime";
|
|
10
|
-
import {
|
|
10
|
+
import { useAui } from "@assistant-ui/store";
|
|
11
11
|
|
|
12
12
|
class RemoteThreadListRuntimeCore
|
|
13
13
|
extends BaseAssistantRuntimeCore
|
|
@@ -42,8 +42,8 @@ const useRemoteThreadListRuntimeImpl = (
|
|
|
42
42
|
export const useRemoteThreadListRuntime = (
|
|
43
43
|
options: RemoteThreadListOptions,
|
|
44
44
|
): AssistantRuntime => {
|
|
45
|
-
const
|
|
46
|
-
const isNested =
|
|
45
|
+
const aui = useAui();
|
|
46
|
+
const isNested = aui.threadListItem.source !== null;
|
|
47
47
|
|
|
48
48
|
if (isNested) {
|
|
49
49
|
if (!options.allowNesting) {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createContext,
|
|
12
12
|
useContext,
|
|
13
13
|
} from "react";
|
|
14
|
-
import {
|
|
14
|
+
import { useAui } from "@assistant-ui/store";
|
|
15
15
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
16
16
|
import { tool } from "./tool";
|
|
17
17
|
|
|
@@ -83,11 +83,11 @@ export const makeAssistantVisible = <T extends ComponentType<any>>(
|
|
|
83
83
|
const clickId = useId();
|
|
84
84
|
const componentRef = useRef<HTMLElement>(null);
|
|
85
85
|
|
|
86
|
-
const
|
|
86
|
+
const aui = useAui();
|
|
87
87
|
|
|
88
88
|
const { clickable, editable } = config ?? {};
|
|
89
89
|
useEffect(() => {
|
|
90
|
-
return
|
|
90
|
+
return aui.modelContext().register({
|
|
91
91
|
getModelContext: () => {
|
|
92
92
|
return {
|
|
93
93
|
tools: {
|
|
@@ -100,7 +100,7 @@ export const makeAssistantVisible = <T extends ComponentType<any>>(
|
|
|
100
100
|
};
|
|
101
101
|
},
|
|
102
102
|
});
|
|
103
|
-
}, [isNestedReadable,
|
|
103
|
+
}, [isNestedReadable, aui, clickable, editable]);
|
|
104
104
|
|
|
105
105
|
const ref = useComposedRefs(componentRef, outerRef);
|
|
106
106
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAui } from "@assistant-ui/store";
|
|
5
5
|
|
|
6
6
|
export type AssistantInstructionsConfig = {
|
|
7
7
|
disabled?: boolean | undefined;
|
|
@@ -19,7 +19,7 @@ export const useAssistantInstructions = (
|
|
|
19
19
|
config: string | AssistantInstructionsConfig,
|
|
20
20
|
) => {
|
|
21
21
|
const { instruction, disabled = false } = getInstructions(config);
|
|
22
|
-
const
|
|
22
|
+
const aui = useAui();
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (disabled) return;
|
|
@@ -27,8 +27,8 @@ export const useAssistantInstructions = (
|
|
|
27
27
|
const config = {
|
|
28
28
|
system: instruction,
|
|
29
29
|
};
|
|
30
|
-
return
|
|
30
|
+
return aui.modelContext().register({
|
|
31
31
|
getModelContext: () => config,
|
|
32
32
|
});
|
|
33
|
-
}, [
|
|
33
|
+
}, [aui, instruction, disabled]);
|
|
34
34
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAui } from "@assistant-ui/store";
|
|
5
5
|
import type { ToolCallMessagePartComponent } from "../types/MessagePartComponentTypes";
|
|
6
6
|
import type { Tool } from "assistant-stream";
|
|
7
7
|
|
|
@@ -19,12 +19,12 @@ export const useAssistantTool = <
|
|
|
19
19
|
>(
|
|
20
20
|
tool: AssistantToolProps<TArgs, TResult>,
|
|
21
21
|
) => {
|
|
22
|
-
const
|
|
22
|
+
const aui = useAui();
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (!tool.render) return undefined;
|
|
26
|
-
return
|
|
27
|
-
}, [
|
|
26
|
+
return aui.tools().setToolUI(tool.toolName, tool.render);
|
|
27
|
+
}, [aui, tool.toolName, tool.render]);
|
|
28
28
|
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
const { toolName, render, ...rest } = tool;
|
|
@@ -33,8 +33,8 @@ export const useAssistantTool = <
|
|
|
33
33
|
[toolName]: rest,
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
|
-
return
|
|
36
|
+
return aui.modelContext().register({
|
|
37
37
|
getModelContext: () => context,
|
|
38
38
|
});
|
|
39
|
-
}, [
|
|
39
|
+
}, [aui, tool]);
|
|
40
40
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAui } from "@assistant-ui/store";
|
|
5
5
|
import type { ToolCallMessagePartComponent } from "../types/MessagePartComponentTypes";
|
|
6
6
|
|
|
7
7
|
export type AssistantToolUIProps<TArgs, TResult> = {
|
|
@@ -12,9 +12,9 @@ export type AssistantToolUIProps<TArgs, TResult> = {
|
|
|
12
12
|
export const useAssistantToolUI = (
|
|
13
13
|
tool: AssistantToolUIProps<any, any> | null,
|
|
14
14
|
) => {
|
|
15
|
-
const
|
|
15
|
+
const aui = useAui();
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
if (!tool?.toolName || !tool?.render) return undefined;
|
|
18
|
-
return
|
|
19
|
-
}, [
|
|
18
|
+
return aui.tools().setToolUI(tool.toolName, tool.render);
|
|
19
|
+
}, [aui, tool?.toolName, tool?.render]);
|
|
20
20
|
};
|
|
@@ -5,7 +5,7 @@ import { ActionButtonProps } from "../../utils/createActionButton";
|
|
|
5
5
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
6
6
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
7
7
|
import { useCallback } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Hook that provides copy functionality for action bar buttons.
|
|
@@ -36,27 +36,27 @@ const useActionBarPrimitiveCopy = ({
|
|
|
36
36
|
}: {
|
|
37
37
|
copiedDuration?: number | undefined;
|
|
38
38
|
} = {}) => {
|
|
39
|
-
const
|
|
40
|
-
const hasCopyableContent =
|
|
39
|
+
const aui = useAui();
|
|
40
|
+
const hasCopyableContent = useAuiState(({ message }) => {
|
|
41
41
|
return (
|
|
42
42
|
(message.role !== "assistant" || message.status?.type !== "running") &&
|
|
43
43
|
message.parts.some((c) => c.type === "text" && c.text.length > 0)
|
|
44
44
|
);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
const isEditing =
|
|
48
|
-
const composerValue =
|
|
47
|
+
const isEditing = useAuiState(({ composer }) => composer.isEditing);
|
|
48
|
+
const composerValue = useAuiState(({ composer }) => composer.text);
|
|
49
49
|
|
|
50
50
|
const callback = useCallback(() => {
|
|
51
|
-
const valueToCopy = isEditing ? composerValue :
|
|
51
|
+
const valueToCopy = isEditing ? composerValue : aui.message().getCopyText();
|
|
52
52
|
|
|
53
53
|
if (!valueToCopy) return;
|
|
54
54
|
|
|
55
55
|
navigator.clipboard.writeText(valueToCopy).then(() => {
|
|
56
|
-
|
|
57
|
-
setTimeout(() =>
|
|
56
|
+
aui.message().setIsCopied(true);
|
|
57
|
+
setTimeout(() => aui.message().setIsCopied(false), copiedDuration);
|
|
58
58
|
});
|
|
59
|
-
}, [
|
|
59
|
+
}, [aui, isEditing, composerValue, copiedDuration]);
|
|
60
60
|
|
|
61
61
|
if (!hasCopyableContent) return null;
|
|
62
62
|
return callback;
|
|
@@ -89,7 +89,7 @@ export const ActionBarPrimitiveCopy = forwardRef<
|
|
|
89
89
|
ActionBarPrimitiveCopy.Element,
|
|
90
90
|
ActionBarPrimitiveCopy.Props
|
|
91
91
|
>(({ copiedDuration, onClick, disabled, ...props }, forwardedRef) => {
|
|
92
|
-
const isCopied =
|
|
92
|
+
const isCopied = useAuiState(({ message }) => message.isCopied);
|
|
93
93
|
const callback = useActionBarPrimitiveCopy({ copiedDuration });
|
|
94
94
|
return (
|
|
95
95
|
<Primitive.button
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
createActionButton,
|
|
7
7
|
} from "../../utils/createActionButton";
|
|
8
8
|
import { useCallback } from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Hook that provides edit functionality for action bar buttons.
|
|
@@ -30,12 +30,12 @@ import { useAssistantState, useAssistantApi } from "../../context";
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
const useActionBarEdit = () => {
|
|
33
|
-
const
|
|
34
|
-
const disabled =
|
|
33
|
+
const aui = useAui();
|
|
34
|
+
const disabled = useAuiState(({ composer }) => composer.isEditing);
|
|
35
35
|
|
|
36
36
|
const callback = useCallback(() => {
|
|
37
|
-
|
|
38
|
-
}, [
|
|
37
|
+
aui.composer().beginEdit();
|
|
38
|
+
}, [aui]);
|
|
39
39
|
|
|
40
40
|
if (disabled) return null;
|
|
41
41
|
return callback;
|
|
@@ -4,7 +4,7 @@ import { forwardRef, useCallback } from "react";
|
|
|
4
4
|
import { ActionButtonProps } from "../../utils/createActionButton";
|
|
5
5
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
6
6
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
7
|
-
import {
|
|
7
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
8
8
|
|
|
9
9
|
const useActionBarExportMarkdown = ({
|
|
10
10
|
filename,
|
|
@@ -13,8 +13,8 @@ const useActionBarExportMarkdown = ({
|
|
|
13
13
|
filename?: string | undefined;
|
|
14
14
|
onExport?: ((content: string) => void | Promise<void>) | undefined;
|
|
15
15
|
} = {}) => {
|
|
16
|
-
const
|
|
17
|
-
const hasExportableContent =
|
|
16
|
+
const aui = useAui();
|
|
17
|
+
const hasExportableContent = useAuiState(({ message }) => {
|
|
18
18
|
return (
|
|
19
19
|
(message.role !== "assistant" || message.status?.type !== "running") &&
|
|
20
20
|
message.parts.some((c) => c.type === "text" && c.text.length > 0)
|
|
@@ -22,7 +22,7 @@ const useActionBarExportMarkdown = ({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const callback = useCallback(async () => {
|
|
25
|
-
const content =
|
|
25
|
+
const content = aui.message().getCopyText();
|
|
26
26
|
if (!content) return;
|
|
27
27
|
|
|
28
28
|
if (onExport) {
|
|
@@ -37,7 +37,7 @@ const useActionBarExportMarkdown = ({
|
|
|
37
37
|
a.download = filename ?? `message-${Date.now()}.md`;
|
|
38
38
|
a.click();
|
|
39
39
|
URL.revokeObjectURL(url);
|
|
40
|
-
}, [
|
|
40
|
+
}, [aui, filename, onExport]);
|
|
41
41
|
|
|
42
42
|
if (!hasExportableContent) return null;
|
|
43
43
|
return callback;
|
|
@@ -5,14 +5,14 @@ import { ActionButtonProps } from "../../utils/createActionButton";
|
|
|
5
5
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
6
6
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
7
7
|
import { useCallback } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
9
9
|
|
|
10
10
|
const useActionBarFeedbackNegative = () => {
|
|
11
|
-
const
|
|
11
|
+
const aui = useAui();
|
|
12
12
|
|
|
13
13
|
const callback = useCallback(() => {
|
|
14
|
-
|
|
15
|
-
}, [
|
|
14
|
+
aui.message().submitFeedback({ type: "negative" });
|
|
15
|
+
}, [aui]);
|
|
16
16
|
|
|
17
17
|
return callback;
|
|
18
18
|
};
|
|
@@ -26,7 +26,7 @@ export const ActionBarPrimitiveFeedbackNegative = forwardRef<
|
|
|
26
26
|
ActionBarPrimitiveFeedbackNegative.Element,
|
|
27
27
|
ActionBarPrimitiveFeedbackNegative.Props
|
|
28
28
|
>(({ onClick, disabled, ...props }, forwardedRef) => {
|
|
29
|
-
const isSubmitted =
|
|
29
|
+
const isSubmitted = useAuiState(
|
|
30
30
|
(s) => s.message.metadata.submittedFeedback?.type === "negative",
|
|
31
31
|
);
|
|
32
32
|
const callback = useActionBarFeedbackNegative();
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
import { forwardRef, useCallback } from "react";
|
|
4
4
|
import { ActionButtonProps } from "../../utils/createActionButton";
|
|
5
5
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
6
|
-
import {
|
|
6
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
7
7
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
8
8
|
|
|
9
9
|
const useActionBarFeedbackPositive = () => {
|
|
10
|
-
const
|
|
10
|
+
const aui = useAui();
|
|
11
11
|
|
|
12
12
|
const callback = useCallback(() => {
|
|
13
|
-
|
|
14
|
-
}, [
|
|
13
|
+
aui.message().submitFeedback({ type: "positive" });
|
|
14
|
+
}, [aui]);
|
|
15
15
|
|
|
16
16
|
return callback;
|
|
17
17
|
};
|
|
@@ -25,7 +25,7 @@ export const ActionBarPrimitiveFeedbackPositive = forwardRef<
|
|
|
25
25
|
ActionBarPrimitiveFeedbackPositive.Element,
|
|
26
26
|
ActionBarPrimitiveFeedbackPositive.Props
|
|
27
27
|
>(({ onClick, disabled, ...props }, forwardedRef) => {
|
|
28
|
-
const isSubmitted =
|
|
28
|
+
const isSubmitted = useAuiState(
|
|
29
29
|
(s) => s.message.metadata.submittedFeedback?.type === "positive",
|
|
30
30
|
);
|
|
31
31
|
const callback = useActionBarFeedbackPositive();
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
createActionButton,
|
|
7
7
|
} from "../../utils/createActionButton";
|
|
8
8
|
import { useCallback } from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Hook that provides reload functionality for action bar buttons.
|
|
@@ -30,9 +30,9 @@ import { useAssistantState, useAssistantApi } from "../../context";
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
const useActionBarReload = () => {
|
|
33
|
-
const
|
|
33
|
+
const aui = useAui();
|
|
34
34
|
|
|
35
|
-
const disabled =
|
|
35
|
+
const disabled = useAuiState(
|
|
36
36
|
(s) =>
|
|
37
37
|
s.thread.isRunning ||
|
|
38
38
|
s.thread.isDisabled ||
|
|
@@ -40,8 +40,8 @@ const useActionBarReload = () => {
|
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
const callback = useCallback(() => {
|
|
43
|
-
|
|
44
|
-
}, [
|
|
43
|
+
aui.message().reload();
|
|
44
|
+
}, [aui]);
|
|
45
45
|
|
|
46
46
|
if (disabled) return null;
|
|
47
47
|
return callback;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useCallback } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
5
5
|
import {
|
|
6
6
|
ActionButtonElement,
|
|
7
7
|
ActionButtonProps,
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
} from "../../utils/createActionButton";
|
|
10
10
|
|
|
11
11
|
const useActionBarSpeak = () => {
|
|
12
|
-
const
|
|
12
|
+
const aui = useAui();
|
|
13
13
|
const callback = useCallback(async () => {
|
|
14
|
-
|
|
15
|
-
}, [
|
|
14
|
+
aui.message().speak();
|
|
15
|
+
}, [aui]);
|
|
16
16
|
|
|
17
|
-
const hasSpeakableContent =
|
|
17
|
+
const hasSpeakableContent = useAuiState(({ message }) => {
|
|
18
18
|
return (
|
|
19
19
|
(message.role !== "assistant" || message.status?.type !== "running") &&
|
|
20
20
|
message.parts.some((c) => c.type === "text" && c.text.length > 0)
|
|
@@ -6,15 +6,15 @@ import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
|
|
6
6
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
7
7
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
8
8
|
import { useCallback } from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
10
|
|
|
11
11
|
const useActionBarStopSpeaking = () => {
|
|
12
|
-
const
|
|
13
|
-
const isSpeaking =
|
|
12
|
+
const aui = useAui();
|
|
13
|
+
const isSpeaking = useAuiState(({ message }) => message.speech != null);
|
|
14
14
|
|
|
15
15
|
const callback = useCallback(() => {
|
|
16
|
-
|
|
17
|
-
}, [
|
|
16
|
+
aui.message().stopSpeaking();
|
|
17
|
+
}, [aui]);
|
|
18
18
|
|
|
19
19
|
if (!isSpeaking) return null;
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
4
4
|
|
|
5
5
|
export enum HideAndFloatStatus {
|
|
6
6
|
Hidden = "hidden",
|
|
@@ -19,7 +19,7 @@ export const useActionBarFloatStatus = ({
|
|
|
19
19
|
autohide,
|
|
20
20
|
autohideFloat,
|
|
21
21
|
}: UseActionBarFloatStatusProps) => {
|
|
22
|
-
return
|
|
22
|
+
return useAuiState(({ thread, message }) => {
|
|
23
23
|
if (hideWhenRunning && thread.isRunning) return HideAndFloatStatus.Hidden;
|
|
24
24
|
|
|
25
25
|
const autohideEnabled =
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { FC, useEffect, useState } from "react";
|
|
4
4
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
5
5
|
import { ScopedProps, usePopoverScope } from "./scope";
|
|
6
|
-
import {
|
|
6
|
+
import { useAui } from "@assistant-ui/store";
|
|
7
7
|
|
|
8
8
|
export namespace AssistantModalPrimitiveRoot {
|
|
9
9
|
export type Props = PopoverPrimitive.PopoverProps & {
|
|
@@ -21,14 +21,14 @@ const useAssistantModalOpenState = ({
|
|
|
21
21
|
const state = useState(defaultOpen);
|
|
22
22
|
|
|
23
23
|
const [, setOpen] = state;
|
|
24
|
-
const
|
|
24
|
+
const aui = useAui();
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
if (!unstable_openOnRunStart) return undefined;
|
|
27
27
|
|
|
28
|
-
return
|
|
28
|
+
return aui.on("thread.runStart", () => {
|
|
29
29
|
setOpen(true);
|
|
30
30
|
});
|
|
31
|
-
}, [unstable_openOnRunStart, setOpen,
|
|
31
|
+
}, [unstable_openOnRunStart, setOpen, aui]);
|
|
32
32
|
|
|
33
33
|
return state;
|
|
34
34
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { FC } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
|
|
6
6
|
export namespace AttachmentPrimitiveName {
|
|
7
7
|
export type Props = Record<string, never>;
|
|
@@ -10,7 +10,7 @@ export namespace AttachmentPrimitiveName {
|
|
|
10
10
|
export const AttachmentPrimitiveName: FC<
|
|
11
11
|
AttachmentPrimitiveName.Props
|
|
12
12
|
> = () => {
|
|
13
|
-
const name =
|
|
13
|
+
const name = useAuiState(({ attachment }) => attachment.name);
|
|
14
14
|
return <>{name}</>;
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
createActionButton,
|
|
7
7
|
} from "../../utils/createActionButton";
|
|
8
8
|
import { useCallback } from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAui } from "@assistant-ui/store";
|
|
10
10
|
|
|
11
11
|
const useAttachmentRemove = () => {
|
|
12
|
-
const
|
|
12
|
+
const aui = useAui();
|
|
13
13
|
|
|
14
14
|
const handleRemoveAttachment = useCallback(() => {
|
|
15
|
-
|
|
16
|
-
}, [
|
|
15
|
+
aui.attachment().remove();
|
|
16
|
+
}, [aui]);
|
|
17
17
|
|
|
18
18
|
return handleRemoveAttachment;
|
|
19
19
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentPropsWithoutRef, forwardRef, type ComponentRef } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
6
6
|
|
|
7
7
|
type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
@@ -15,7 +15,7 @@ export const AttachmentPrimitiveThumb = forwardRef<
|
|
|
15
15
|
AttachmentPrimitiveThumb.Element,
|
|
16
16
|
AttachmentPrimitiveThumb.Props
|
|
17
17
|
>((props, ref) => {
|
|
18
|
-
const ext =
|
|
18
|
+
const ext = useAuiState(({ attachment }) => {
|
|
19
19
|
const parts = attachment.name.split(".");
|
|
20
20
|
return parts.length > 1 ? parts.pop()! : "";
|
|
21
21
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { FC } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
|
|
6
6
|
const useBranchPickerCount = () => {
|
|
7
|
-
const branchCount =
|
|
7
|
+
const branchCount = useAuiState(({ message }) => message.branchCount);
|
|
8
8
|
return branchCount;
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
createActionButton,
|
|
7
7
|
} from "../../utils/createActionButton";
|
|
8
8
|
import { useCallback } from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
10
|
|
|
11
11
|
const useBranchPickerNext = () => {
|
|
12
|
-
const
|
|
13
|
-
const disabled =
|
|
12
|
+
const aui = useAui();
|
|
13
|
+
const disabled = useAuiState(({ thread, message }) => {
|
|
14
14
|
// Disabled if no next branch
|
|
15
15
|
if (message.branchNumber >= message.branchCount) return true;
|
|
16
16
|
|
|
@@ -23,8 +23,8 @@ const useBranchPickerNext = () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
const callback = useCallback(() => {
|
|
26
|
-
|
|
27
|
-
}, [
|
|
26
|
+
aui.message().switchToBranch({ position: "next" });
|
|
27
|
+
}, [aui]);
|
|
28
28
|
|
|
29
29
|
if (disabled) return null;
|
|
30
30
|
return callback;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { FC } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
|
|
6
6
|
const useBranchPickerNumber = () => {
|
|
7
|
-
const branchNumber =
|
|
7
|
+
const branchNumber = useAuiState(({ message }) => message.branchNumber);
|
|
8
8
|
return branchNumber;
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
createActionButton,
|
|
7
7
|
} from "../../utils/createActionButton";
|
|
8
8
|
import { useCallback } from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Hook that provides navigation to the previous branch functionality.
|
|
@@ -30,8 +30,8 @@ import { useAssistantState, useAssistantApi } from "../../context";
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
const useBranchPickerPrevious = () => {
|
|
33
|
-
const
|
|
34
|
-
const disabled =
|
|
33
|
+
const aui = useAui();
|
|
34
|
+
const disabled = useAuiState(({ thread, message }) => {
|
|
35
35
|
// Disabled if no previous branch
|
|
36
36
|
if (message.branchNumber <= 1) return true;
|
|
37
37
|
|
|
@@ -44,8 +44,8 @@ const useBranchPickerPrevious = () => {
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
const callback = useCallback(() => {
|
|
47
|
-
|
|
48
|
-
}, [
|
|
47
|
+
aui.message().switchToBranch({ position: "previous" });
|
|
48
|
+
}, [aui]);
|
|
49
49
|
|
|
50
50
|
if (disabled) return null;
|
|
51
51
|
return callback;
|