@assistant-ui/react 0.5.12 → 0.5.14

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.mts CHANGED
@@ -554,9 +554,9 @@ type EdgeRuntimeRequestOptions = z.infer<typeof EdgeRuntimeRequestOptionsSchema>
554
554
  type ThreadMessageLike = {
555
555
  role: "assistant" | "user" | "system";
556
556
  content: (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
557
- id?: string;
558
- createdAt?: Date;
559
- status?: MessageStatus;
557
+ id?: string | undefined;
558
+ createdAt?: Date | undefined;
559
+ status?: MessageStatus | undefined;
560
560
  };
561
561
 
562
562
  type ExternalStoreMessageConverter<T> = (message: T, idx: number) => ThreadMessageLike;
package/dist/index.d.ts CHANGED
@@ -554,9 +554,9 @@ type EdgeRuntimeRequestOptions = z.infer<typeof EdgeRuntimeRequestOptionsSchema>
554
554
  type ThreadMessageLike = {
555
555
  role: "assistant" | "user" | "system";
556
556
  content: (TextContentPart | ImageContentPart | ToolCallContentPart<any, any> | CoreToolCallContentPart<any, any> | UIContentPart)[];
557
- id?: string;
558
- createdAt?: Date;
559
- status?: MessageStatus;
557
+ id?: string | undefined;
558
+ createdAt?: Date | undefined;
559
+ status?: MessageStatus | undefined;
560
560
  };
561
561
 
562
562
  type ExternalStoreMessageConverter<T> = (message: T, idx: number) => ThreadMessageLike;
package/dist/index.js CHANGED
@@ -1290,7 +1290,7 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
1290
1290
  if (message.content.length === 0 && partIndex === 0) {
1291
1291
  part = EMPTY_CONTENT;
1292
1292
  } else {
1293
- return;
1293
+ return null;
1294
1294
  }
1295
1295
  }
1296
1296
  const status = toContentPartStatus(message, partIndex, part);
@@ -1919,6 +1919,7 @@ var getIsLast = (messages, message) => {
1919
1919
  var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
1920
1920
  const parentId = messages[messageIndex - 1]?.id ?? null;
1921
1921
  const message = messages[messageIndex];
1922
+ if (!message) return null;
1922
1923
  const isLast = getIsLast(messages, message);
1923
1924
  const branches = getBranches(message.id);
1924
1925
  const currentState = useMessage?.getState();