@assistant-ui/react 0.5.50 → 0.5.52

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.mts CHANGED
@@ -557,6 +557,11 @@ type AssistantRuntimeProviderProps = {
557
557
  };
558
558
  declare const AssistantRuntimeProvider: react.NamedExoticComponent<PropsWithChildren<AssistantRuntimeProviderProps>>;
559
559
 
560
+ type TextContentPartProviderProps = {
561
+ text: string;
562
+ };
563
+ declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
564
+
560
565
  type AssistantActionsState = Readonly<{
561
566
  switchToThread: (threadId: string | null) => void;
562
567
  getRuntime: () => AssistantRuntime;
@@ -1418,4 +1423,4 @@ declare const exports: {
1418
1423
  Text: FC;
1419
1424
  };
1420
1425
 
1421
- export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$b as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, type AttachmentAdapter, _default$8 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$7 as Composer, _default$6 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$4 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$2 as UserActionBar, _default$3 as UserMessage, _default$1 as UserMessageAttachment, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerAddAttachment, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
1426
+ export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$b as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, type AttachmentAdapter, _default$8 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$7 as Composer, _default$6 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, TextContentPartProvider, _default$4 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$2 as UserActionBar, _default$3 as UserMessage, _default$1 as UserMessageAttachment, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerAddAttachment, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
package/dist/index.d.ts CHANGED
@@ -557,6 +557,11 @@ type AssistantRuntimeProviderProps = {
557
557
  };
558
558
  declare const AssistantRuntimeProvider: react.NamedExoticComponent<PropsWithChildren<AssistantRuntimeProviderProps>>;
559
559
 
560
+ type TextContentPartProviderProps = {
561
+ text: string;
562
+ };
563
+ declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
564
+
560
565
  type AssistantActionsState = Readonly<{
561
566
  switchToThread: (threadId: string | null) => void;
562
567
  getRuntime: () => AssistantRuntime;
@@ -1418,4 +1423,4 @@ declare const exports: {
1418
1423
  Text: FC;
1419
1424
  };
1420
1425
 
1421
- export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$b as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, type AttachmentAdapter, _default$8 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$7 as Composer, _default$6 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, _default$4 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$2 as UserActionBar, _default$3 as UserMessage, _default$1 as UserMessageAttachment, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerAddAttachment, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
1426
+ export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$b as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, type AttachmentAdapter, _default$8 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$7 as Composer, _default$6 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, type EditComposerState, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, TextContentPartProvider, _default$4 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$2 as UserActionBar, _default$3 as UserMessage, _default$1 as UserMessageAttachment, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerAddAttachment, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
package/dist/index.js CHANGED
@@ -2271,6 +2271,39 @@ var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
2271
2271
  };
2272
2272
  var AssistantRuntimeProvider = _react.memo.call(void 0, AssistantRuntimeProviderImpl);
2273
2273
 
2274
+ // src/context/providers/TextContentPartProvider.tsx
2275
+
2276
+
2277
+
2278
+ // src/context/react/ContentPartContext.ts
2279
+
2280
+ var ContentPartContext = _react.createContext.call(void 0,
2281
+ null
2282
+ );
2283
+ function useContentPartContext(options) {
2284
+ const context = _react.useContext.call(void 0, ContentPartContext);
2285
+ if (!_optionalChain([options, 'optionalAccess', _96 => _96.optional]) && !context)
2286
+ throw new Error(
2287
+ "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
2288
+ );
2289
+ return context;
2290
+ }
2291
+
2292
+ // src/context/providers/TextContentPartProvider.tsx
2293
+
2294
+ var TextContentPartProvider = ({ children, text }) => {
2295
+ const [context] = _react.useState.call(void 0, () => {
2296
+ const useContentPart = _zustand.create.call(void 0, () => ({
2297
+ status: { type: "complete" },
2298
+ part: { type: "text", text }
2299
+ }));
2300
+ return {
2301
+ useContentPart
2302
+ };
2303
+ });
2304
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartContext.Provider, { value: context, children });
2305
+ };
2306
+
2274
2307
  // src/context/react/ComposerContext.ts
2275
2308
 
2276
2309
 
@@ -2279,7 +2312,7 @@ var AssistantRuntimeProvider = _react.memo.call(void 0, AssistantRuntimeProvider
2279
2312
  var MessageContext = _react.createContext.call(void 0, null);
2280
2313
  function useMessageContext(options) {
2281
2314
  const context = _react.useContext.call(void 0, MessageContext);
2282
- if (!_optionalChain([options, 'optionalAccess', _96 => _96.optional]) && !context)
2315
+ if (!_optionalChain([options, 'optionalAccess', _97 => _97.optional]) && !context)
2283
2316
  throw new Error(
2284
2317
  "This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
2285
2318
  );
@@ -2299,20 +2332,6 @@ var useComposerContext = () => {
2299
2332
  );
2300
2333
  };
2301
2334
 
2302
- // src/context/react/ContentPartContext.ts
2303
-
2304
- var ContentPartContext = _react.createContext.call(void 0,
2305
- null
2306
- );
2307
- function useContentPartContext(options) {
2308
- const context = _react.useContext.call(void 0, ContentPartContext);
2309
- if (!_optionalChain([options, 'optionalAccess', _97 => _97.optional]) && !context)
2310
- throw new Error(
2311
- "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
2312
- );
2313
- return context;
2314
- }
2315
-
2316
2335
  // src/hooks/useAppendMessage.tsx
2317
2336
 
2318
2337
  var toAppendMessage = (useThreadMessages, message) => {
@@ -2869,9 +2888,9 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
2869
2888
  _reactprimitive.Primitive.button,
2870
2889
  {
2871
2890
  type: "button",
2872
- disabled: !callback,
2873
2891
  ...primitiveProps,
2874
2892
  ref: forwardedRef,
2893
+ disabled: primitiveProps.disabled || !callback,
2875
2894
  onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
2876
2895
  _optionalChain([callback, 'optionalCall', _112 => _112()]);
2877
2896
  })
@@ -4049,6 +4068,8 @@ var useMessageContext2 = (messageIndex) => {
4049
4068
  throw new Error(
4050
4069
  "Tried to edit a non-user message. Editing is only supported for user messages. This is likely an internal bug in assistant-ui."
4051
4070
  );
4071
+ const previousText = getThreadMessageText(message);
4072
+ if (previousText === text) return;
4052
4073
  const nonTextParts = message.content.filter(
4053
4074
  (part) => part.type !== "text" && part.type !== "ui"
4054
4075
  );
@@ -5121,5 +5142,6 @@ var assistant_modal_default = Object.assign(AssistantModal, exports13);
5121
5142
 
5122
5143
 
5123
5144
 
5124
- exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerAttachment = composer_attachment_default; exports.ComposerPrimitive = composer_exports; exports.CompositeAttachmentAdapter = CompositeAttachmentAdapter; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.ExternalStoreRuntime = ExternalStoreRuntime; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.SimpleImageAttachmentAdapter = SimpleImageAttachmentAdapter; exports.SimpleTextAttachmentAdapter = SimpleTextAttachmentAdapter; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.UserMessageAttachment = user_message_attachment_default; exports.WebSpeechSynthesisAdapter = WebSpeechSynthesisAdapter; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.subscribeToMainThread = subscribeToMainThread; exports.toCoreMessage = _chunk4LR4BB23js.toCoreMessage; exports.toCoreMessages = _chunk4LR4BB23js.toCoreMessages; exports.toLanguageModelMessages = _chunk4LR4BB23js.toLanguageModelMessages; exports.toLanguageModelTools = _chunk4LR4BB23js.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposerAddAttachment = useComposerAddAttachment; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerSend = useComposerSend; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadSuggestion = useThreadSuggestion;
5145
+
5146
+ exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerAttachment = composer_attachment_default; exports.ComposerPrimitive = composer_exports; exports.CompositeAttachmentAdapter = CompositeAttachmentAdapter; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.ExternalStoreRuntime = ExternalStoreRuntime; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.SimpleImageAttachmentAdapter = SimpleImageAttachmentAdapter; exports.SimpleTextAttachmentAdapter = SimpleTextAttachmentAdapter; exports.TextContentPartProvider = TextContentPartProvider; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.UserMessageAttachment = user_message_attachment_default; exports.WebSpeechSynthesisAdapter = WebSpeechSynthesisAdapter; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.subscribeToMainThread = subscribeToMainThread; exports.toCoreMessage = _chunk4LR4BB23js.toCoreMessage; exports.toCoreMessages = _chunk4LR4BB23js.toCoreMessages; exports.toLanguageModelMessages = _chunk4LR4BB23js.toLanguageModelMessages; exports.toLanguageModelTools = _chunk4LR4BB23js.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposerAddAttachment = useComposerAddAttachment; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerSend = useComposerSend; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadSuggestion = useThreadSuggestion;
5125
5147
  //# sourceMappingURL=index.js.map