@lukeashford/aurelius 3.8.0 → 3.9.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/index.d.mts +163 -151
- package/dist/index.d.ts +163 -151
- package/dist/index.js +34 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -21
- package/dist/index.mjs.map +1 -1
- package/llms.md +4 -6
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
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];
|
|
@@ -4648,6 +4646,7 @@ var ChatInput = React59.forwardRef(
|
|
|
4648
4646
|
onStop,
|
|
4649
4647
|
attachments: controlledAttachments,
|
|
4650
4648
|
onAttachmentsChange,
|
|
4649
|
+
onAttachmentRemove,
|
|
4651
4650
|
showAttachmentButton = true,
|
|
4652
4651
|
acceptedFileTypes,
|
|
4653
4652
|
notice,
|
|
@@ -4734,15 +4733,19 @@ var ChatInput = React59.forwardRef(
|
|
|
4734
4733
|
);
|
|
4735
4734
|
const handleRemoveAttachment = useCallback13(
|
|
4736
4735
|
(id) => {
|
|
4736
|
+
const attachment = attachments.find((a) => a.id === id);
|
|
4737
|
+
if (attachment && onAttachmentRemove) {
|
|
4738
|
+
onAttachmentRemove(attachment);
|
|
4739
|
+
}
|
|
4737
4740
|
setAttachments((prev) => {
|
|
4738
|
-
const
|
|
4739
|
-
if (
|
|
4740
|
-
URL.revokeObjectURL(
|
|
4741
|
+
const attachmentToRemove = prev.find((a) => a.id === id);
|
|
4742
|
+
if (attachmentToRemove?.previewUrl) {
|
|
4743
|
+
URL.revokeObjectURL(attachmentToRemove.previewUrl);
|
|
4741
4744
|
}
|
|
4742
4745
|
return prev.filter((a) => a.id !== id);
|
|
4743
4746
|
});
|
|
4744
4747
|
},
|
|
4745
|
-
[setAttachments]
|
|
4748
|
+
[attachments, onAttachmentRemove, setAttachments]
|
|
4746
4749
|
);
|
|
4747
4750
|
const handleDragEnter = useCallback13((e) => {
|
|
4748
4751
|
e.preventDefault();
|
|
@@ -4774,7 +4777,8 @@ var ChatInput = React59.forwardRef(
|
|
|
4774
4777
|
);
|
|
4775
4778
|
const isCentered = position === "centered";
|
|
4776
4779
|
const hasAttachments = attachments.length > 0;
|
|
4777
|
-
const
|
|
4780
|
+
const isUploading = attachments.some((a) => a.status === "uploading");
|
|
4781
|
+
const canSubmit = value.trim() && !disabled && !isStreaming && !isUploading;
|
|
4778
4782
|
return /* @__PURE__ */ React59.createElement(
|
|
4779
4783
|
"div",
|
|
4780
4784
|
{
|
|
@@ -6688,6 +6692,7 @@ var ChatInterface = React74.forwardRef(
|
|
|
6688
6692
|
enableMessageActions = true,
|
|
6689
6693
|
attachments: propsAttachments,
|
|
6690
6694
|
onAttachmentsChange,
|
|
6695
|
+
onAttachmentRemove,
|
|
6691
6696
|
artifactNodes,
|
|
6692
6697
|
isArtifactsPanelOpen,
|
|
6693
6698
|
onArtifactsPanelOpenChange,
|
|
@@ -6788,19 +6793,13 @@ var ChatInterface = React74.forwardRef(
|
|
|
6788
6793
|
const isTreeMode = !!conversationTree;
|
|
6789
6794
|
const effectiveMessages = useMemo5(() => {
|
|
6790
6795
|
if (isTreeMode && conversationTree) {
|
|
6791
|
-
|
|
6792
|
-
return pathNodes.map((node) => ({
|
|
6793
|
-
id: node.id,
|
|
6794
|
-
variant: node.role,
|
|
6795
|
-
content: node.content,
|
|
6796
|
-
isStreaming: node.isStreaming
|
|
6797
|
-
}));
|
|
6796
|
+
return getActivePathMessages(conversationTree);
|
|
6798
6797
|
}
|
|
6799
|
-
return messages;
|
|
6798
|
+
return messages || [];
|
|
6800
6799
|
}, [isTreeMode, conversationTree, messages]);
|
|
6801
6800
|
const latestUserMessageIndex = useMemo5(() => {
|
|
6802
6801
|
for (let i = effectiveMessages.length - 1; i >= 0; i--) {
|
|
6803
|
-
if (effectiveMessages[i].
|
|
6802
|
+
if (effectiveMessages[i].role === "user") {
|
|
6804
6803
|
return i;
|
|
6805
6804
|
}
|
|
6806
6805
|
}
|
|
@@ -6857,10 +6856,23 @@ var ChatInterface = React74.forwardRef(
|
|
|
6857
6856
|
}
|
|
6858
6857
|
const actions = enableMessageActions ? {
|
|
6859
6858
|
showCopy: true,
|
|
6860
|
-
onEdit: msg.
|
|
6861
|
-
onRetry: msg.
|
|
6859
|
+
onEdit: msg.role === "user" && onEditMessage ? (newContent) => onEditMessage(msg.id, newContent) : void 0,
|
|
6860
|
+
onRetry: msg.role === "assistant" && onRetryMessage ? () => onRetryMessage(msg.id) : void 0
|
|
6862
6861
|
} : void 0;
|
|
6863
|
-
|
|
6862
|
+
const {
|
|
6863
|
+
role,
|
|
6864
|
+
parentId,
|
|
6865
|
+
children,
|
|
6866
|
+
branchIndex,
|
|
6867
|
+
createdAt,
|
|
6868
|
+
...rest2
|
|
6869
|
+
} = msg;
|
|
6870
|
+
return {
|
|
6871
|
+
...rest2,
|
|
6872
|
+
variant: role,
|
|
6873
|
+
branchInfo,
|
|
6874
|
+
actions
|
|
6875
|
+
};
|
|
6864
6876
|
});
|
|
6865
6877
|
}, [
|
|
6866
6878
|
effectiveMessages,
|
|
@@ -6990,6 +7002,7 @@ var ChatInterface = React74.forwardRef(
|
|
|
6990
7002
|
showAttachmentButton,
|
|
6991
7003
|
attachments: propsAttachments,
|
|
6992
7004
|
onAttachmentsChange,
|
|
7005
|
+
onAttachmentRemove,
|
|
6993
7006
|
notice: inputNotice,
|
|
6994
7007
|
onInputChange,
|
|
6995
7008
|
initialInputValue,
|