@lukeashford/aurelius 3.8.0 → 3.8.1

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/index.mjs CHANGED
@@ -4504,14 +4504,13 @@ function addMessageToTree(tree, message, parentId = null) {
4504
4504
  } else if (!parentId) {
4505
4505
  branchIndex = newRootIds.length;
4506
4506
  }
4507
- const newNode = {
4507
+ newNodes[message.id] = {
4508
4508
  ...message,
4509
4509
  parentId,
4510
4510
  children: [],
4511
4511
  branchIndex,
4512
4512
  createdAt: message.createdAt ?? Date.now()
4513
4513
  };
4514
- newNodes[message.id] = newNode;
4515
4514
  if (parentId && newNodes[parentId]) {
4516
4515
  newNodes[parentId] = {
4517
4516
  ...newNodes[parentId],
@@ -4587,8 +4586,7 @@ function switchBranch(tree, nodeId, direction) {
4587
4586
  return tree;
4588
4587
  }
4589
4588
  const newIndex = direction === "next" ? (currentIndex + 1) % siblings.length : (currentIndex - 1 + siblings.length) % siblings.length;
4590
- const newNodeId = siblings[newIndex];
4591
- let leafId = newNodeId;
4589
+ let leafId = siblings[newIndex];
4592
4590
  let currentNode = tree.nodes[leafId];
4593
4591
  while (currentNode && currentNode.children.length > 0) {
4594
4592
  leafId = currentNode.children[0];
@@ -6788,19 +6786,13 @@ var ChatInterface = React74.forwardRef(
6788
6786
  const isTreeMode = !!conversationTree;
6789
6787
  const effectiveMessages = useMemo5(() => {
6790
6788
  if (isTreeMode && conversationTree) {
6791
- const pathNodes = getActivePathMessages(conversationTree);
6792
- return pathNodes.map((node) => ({
6793
- id: node.id,
6794
- variant: node.role,
6795
- content: node.content,
6796
- isStreaming: node.isStreaming
6797
- }));
6789
+ return getActivePathMessages(conversationTree);
6798
6790
  }
6799
- return messages;
6791
+ return messages || [];
6800
6792
  }, [isTreeMode, conversationTree, messages]);
6801
6793
  const latestUserMessageIndex = useMemo5(() => {
6802
6794
  for (let i = effectiveMessages.length - 1; i >= 0; i--) {
6803
- if (effectiveMessages[i].variant === "user") {
6795
+ if (effectiveMessages[i].role === "user") {
6804
6796
  return i;
6805
6797
  }
6806
6798
  }
@@ -6857,10 +6849,23 @@ var ChatInterface = React74.forwardRef(
6857
6849
  }
6858
6850
  const actions = enableMessageActions ? {
6859
6851
  showCopy: true,
6860
- onEdit: msg.variant === "user" && onEditMessage ? (newContent) => onEditMessage(msg.id, newContent) : void 0,
6861
- onRetry: msg.variant === "assistant" && onRetryMessage ? () => onRetryMessage(msg.id) : void 0
6852
+ onEdit: msg.role === "user" && onEditMessage ? (newContent) => onEditMessage(msg.id, newContent) : void 0,
6853
+ onRetry: msg.role === "assistant" && onRetryMessage ? () => onRetryMessage(msg.id) : void 0
6862
6854
  } : void 0;
6863
- return { ...msg, branchInfo, actions };
6855
+ const {
6856
+ role,
6857
+ parentId,
6858
+ children,
6859
+ branchIndex,
6860
+ createdAt,
6861
+ ...rest2
6862
+ } = msg;
6863
+ return {
6864
+ ...rest2,
6865
+ variant: role,
6866
+ branchInfo,
6867
+ actions
6868
+ };
6864
6869
  });
6865
6870
  }, [
6866
6871
  effectiveMessages,