@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.d.mts +8 -25
- package/dist/index.d.ts +8 -25
- package/dist/index.js +21 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -16
- package/dist/index.mjs.map +1 -1
- package/llms.md +0 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React$1 from 'react';
|
|
1
|
+
import React$1, { ReactNode } from 'react';
|
|
2
2
|
import { Config } from 'dompurify';
|
|
3
3
|
|
|
4
4
|
type ButtonVariant = 'primary' | 'important' | 'elevated' | 'outlined' | 'featured' | 'ghost' | 'danger';
|
|
@@ -1185,6 +1185,7 @@ interface ArtifactNode {
|
|
|
1185
1185
|
* - Retry assistant responses (creating a new branch)
|
|
1186
1186
|
* - Navigate between different conversation branches
|
|
1187
1187
|
*/
|
|
1188
|
+
|
|
1188
1189
|
/**
|
|
1189
1190
|
* A node in the conversation tree
|
|
1190
1191
|
*/
|
|
@@ -1198,9 +1199,9 @@ interface MessageNode {
|
|
|
1198
1199
|
*/
|
|
1199
1200
|
role: 'user' | 'assistant';
|
|
1200
1201
|
/**
|
|
1201
|
-
* The message content (may include HTML/markdown)
|
|
1202
|
+
* The message content (may include HTML/markdown or React components)
|
|
1202
1203
|
*/
|
|
1203
|
-
content:
|
|
1204
|
+
content: ReactNode;
|
|
1204
1205
|
/**
|
|
1205
1206
|
* ID of the parent message (null for root messages)
|
|
1206
1207
|
*/
|
|
@@ -1283,14 +1284,14 @@ declare function switchBranch(tree: ConversationTree, nodeId: string, direction:
|
|
|
1283
1284
|
/**
|
|
1284
1285
|
* Update a node's content (e.g., during streaming)
|
|
1285
1286
|
*/
|
|
1286
|
-
declare function updateNodeContent(tree: ConversationTree, nodeId: string, content:
|
|
1287
|
+
declare function updateNodeContent(tree: ConversationTree, nodeId: string, content: ReactNode, isStreaming?: boolean): ConversationTree;
|
|
1287
1288
|
/**
|
|
1288
1289
|
* Convert a flat message array to a conversation tree
|
|
1289
1290
|
*/
|
|
1290
1291
|
declare function messagesToTree(messages: Array<{
|
|
1291
1292
|
id: string;
|
|
1292
1293
|
role: 'user' | 'assistant';
|
|
1293
|
-
content:
|
|
1294
|
+
content: ReactNode;
|
|
1294
1295
|
isStreaming?: boolean;
|
|
1295
1296
|
}>): ConversationTree;
|
|
1296
1297
|
/**
|
|
@@ -1298,24 +1299,6 @@ declare function messagesToTree(messages: Array<{
|
|
|
1298
1299
|
*/
|
|
1299
1300
|
declare function isBranchPoint(tree: ConversationTree, nodeId: string): boolean;
|
|
1300
1301
|
|
|
1301
|
-
interface ChatMessage {
|
|
1302
|
-
/**
|
|
1303
|
-
* Unique identifier for the message
|
|
1304
|
-
*/
|
|
1305
|
-
id: string;
|
|
1306
|
-
/**
|
|
1307
|
-
* Whether the message is from the user or the assistant
|
|
1308
|
-
*/
|
|
1309
|
-
variant: 'user' | 'assistant';
|
|
1310
|
-
/**
|
|
1311
|
-
* Message content (Markdown supported)
|
|
1312
|
-
*/
|
|
1313
|
-
content: string;
|
|
1314
|
-
/**
|
|
1315
|
-
* Whether the message is currently streaming
|
|
1316
|
-
*/
|
|
1317
|
-
isStreaming?: boolean;
|
|
1318
|
-
}
|
|
1319
1302
|
interface Conversation {
|
|
1320
1303
|
/**
|
|
1321
1304
|
* Unique identifier for the conversation
|
|
@@ -1345,7 +1328,7 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1345
1328
|
* Array of messages in the conversation (flat mode)
|
|
1346
1329
|
* Use this OR conversationTree, not both
|
|
1347
1330
|
*/
|
|
1348
|
-
messages?:
|
|
1331
|
+
messages?: MessageNode[];
|
|
1349
1332
|
/**
|
|
1350
1333
|
* Conversation tree for branching support
|
|
1351
1334
|
* Use this OR messages, not both
|
|
@@ -2042,4 +2025,4 @@ declare const ArtifactVariantStack: React$1.ForwardRefExoticComponent<ArtifactVa
|
|
|
2042
2025
|
|
|
2043
2026
|
declare const version = "2.0.0";
|
|
2044
2027
|
|
|
2045
|
-
export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps,
|
|
2028
|
+
export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps, ChatView, type ChatViewItem, type ChatViewProps, CheckSquareIcon, Checkbox, type CheckboxProps, ChevronLeftIcon, ChevronRightIcon, CloseIcon, Col, type ColOffset, type ColOrder, type ColProps, type ColSpan, ColorSwatch, type ColorSwatchProps, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, type ContainerSize, type Conversation, type ConversationTree, CrossSquareIcon, Divider, type DividerProps, Drawer, type DrawerPosition, type DrawerProps, EmptySquareIcon, ExpandIcon, type ExternalToolDefinition, FileChip, type FileChipProps, type FileChipStatus, HelperText, type HelperTextProps, HistoryIcon, HistoryPanel, type HistoryPanelProps, type IconProps, ImageCard, type ImageCardProps, Input, type InputAddonProps, type InputElementProps, InputGroup, type InputGroupProps, InputLeftAddon, InputLeftElement, type InputProps, InputRightAddon, InputRightElement, InputWrapper, type InputWrapperProps, Label, type LabelProps, LayersIcon, List, ListItem, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MarkdownContent, type MarkdownContentProps, MediaIcon, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, MenuTrigger, type MenuTriggerProps, Message, MessageActions, type MessageActionsConfig, type MessageActionsProps, type MessageActionsVariant, type MessageBranchInfo, type MessageNode, type MessageProps, type MessageVariant, Modal, type ModalProps, NODE_TYPES, Navbar, NavbarBrand, type NavbarBrandProps, NavbarContent, type NavbarContentProps, NavbarDivider, NavbarItem, type NavbarItemProps, NavbarLink, type NavbarLinkProps, type NavbarProps, type NodeType, Pagination, type PaginationProps, PdfCard, type PdfCardProps, PlusIcon, Popover, type PopoverAlign, type PopoverPosition, type PopoverProps, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Radio, type RadioProps, Row, type RowAlign, type RowGutter, type RowJustify, type RowProps, SCRIPT_ELEMENT_TYPES, ScriptCard, type ScriptCardProps, type ScriptElement, type ScriptElementType, SectionHeading, type SectionHeadingLevel, type SectionHeadingProps, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, SquareLoaderIcon, Stack, type StackDirection, type StackGap, type StackProps, type Step, type StepStatus, Stepper, type StepperProps, StreamingCursor, type StreamingCursorProps, Switch, type SwitchProps, TASK_STATUSES, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type Task, type TaskStatus, TextCard, type TextCardProps, Textarea, type TextareaProps, ThinkingIndicator, type ThinkingIndicatorProps, type ToastData, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, TodosList, type TodosListProps, type ToolDefinition, type ToolGroup, ToolPanelContainer, type ToolPanelContainerProps, type ToolPanelState, ToolSidebar, type ToolSidebarProps, Tooltip, type TooltipProps, type UseArtifactTreeNavigationReturn, type UseScrollAnchorOptions, type UseScrollAnchorReturn, type VideoAspectRatio, type VideoAspectRatioPreset, VideoCard, type VideoCardProps, addMessageToTree, areAllTasksSettled, createEmptyTree, createPreviewUrl, generateId, getActivePathMessages, getSiblingInfo, isBranchPoint, isImageFile, messagesToTree, revokePreviewUrl, switchBranch, updateNodeContent, useArtifactTreeNavigation, useResizable, useScrollAnchor, useToast, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React$1 from 'react';
|
|
1
|
+
import React$1, { ReactNode } from 'react';
|
|
2
2
|
import { Config } from 'dompurify';
|
|
3
3
|
|
|
4
4
|
type ButtonVariant = 'primary' | 'important' | 'elevated' | 'outlined' | 'featured' | 'ghost' | 'danger';
|
|
@@ -1185,6 +1185,7 @@ interface ArtifactNode {
|
|
|
1185
1185
|
* - Retry assistant responses (creating a new branch)
|
|
1186
1186
|
* - Navigate between different conversation branches
|
|
1187
1187
|
*/
|
|
1188
|
+
|
|
1188
1189
|
/**
|
|
1189
1190
|
* A node in the conversation tree
|
|
1190
1191
|
*/
|
|
@@ -1198,9 +1199,9 @@ interface MessageNode {
|
|
|
1198
1199
|
*/
|
|
1199
1200
|
role: 'user' | 'assistant';
|
|
1200
1201
|
/**
|
|
1201
|
-
* The message content (may include HTML/markdown)
|
|
1202
|
+
* The message content (may include HTML/markdown or React components)
|
|
1202
1203
|
*/
|
|
1203
|
-
content:
|
|
1204
|
+
content: ReactNode;
|
|
1204
1205
|
/**
|
|
1205
1206
|
* ID of the parent message (null for root messages)
|
|
1206
1207
|
*/
|
|
@@ -1283,14 +1284,14 @@ declare function switchBranch(tree: ConversationTree, nodeId: string, direction:
|
|
|
1283
1284
|
/**
|
|
1284
1285
|
* Update a node's content (e.g., during streaming)
|
|
1285
1286
|
*/
|
|
1286
|
-
declare function updateNodeContent(tree: ConversationTree, nodeId: string, content:
|
|
1287
|
+
declare function updateNodeContent(tree: ConversationTree, nodeId: string, content: ReactNode, isStreaming?: boolean): ConversationTree;
|
|
1287
1288
|
/**
|
|
1288
1289
|
* Convert a flat message array to a conversation tree
|
|
1289
1290
|
*/
|
|
1290
1291
|
declare function messagesToTree(messages: Array<{
|
|
1291
1292
|
id: string;
|
|
1292
1293
|
role: 'user' | 'assistant';
|
|
1293
|
-
content:
|
|
1294
|
+
content: ReactNode;
|
|
1294
1295
|
isStreaming?: boolean;
|
|
1295
1296
|
}>): ConversationTree;
|
|
1296
1297
|
/**
|
|
@@ -1298,24 +1299,6 @@ declare function messagesToTree(messages: Array<{
|
|
|
1298
1299
|
*/
|
|
1299
1300
|
declare function isBranchPoint(tree: ConversationTree, nodeId: string): boolean;
|
|
1300
1301
|
|
|
1301
|
-
interface ChatMessage {
|
|
1302
|
-
/**
|
|
1303
|
-
* Unique identifier for the message
|
|
1304
|
-
*/
|
|
1305
|
-
id: string;
|
|
1306
|
-
/**
|
|
1307
|
-
* Whether the message is from the user or the assistant
|
|
1308
|
-
*/
|
|
1309
|
-
variant: 'user' | 'assistant';
|
|
1310
|
-
/**
|
|
1311
|
-
* Message content (Markdown supported)
|
|
1312
|
-
*/
|
|
1313
|
-
content: string;
|
|
1314
|
-
/**
|
|
1315
|
-
* Whether the message is currently streaming
|
|
1316
|
-
*/
|
|
1317
|
-
isStreaming?: boolean;
|
|
1318
|
-
}
|
|
1319
1302
|
interface Conversation {
|
|
1320
1303
|
/**
|
|
1321
1304
|
* Unique identifier for the conversation
|
|
@@ -1345,7 +1328,7 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1345
1328
|
* Array of messages in the conversation (flat mode)
|
|
1346
1329
|
* Use this OR conversationTree, not both
|
|
1347
1330
|
*/
|
|
1348
|
-
messages?:
|
|
1331
|
+
messages?: MessageNode[];
|
|
1349
1332
|
/**
|
|
1350
1333
|
* Conversation tree for branching support
|
|
1351
1334
|
* Use this OR messages, not both
|
|
@@ -2042,4 +2025,4 @@ declare const ArtifactVariantStack: React$1.ForwardRefExoticComponent<ArtifactVa
|
|
|
2042
2025
|
|
|
2043
2026
|
declare const version = "2.0.0";
|
|
2044
2027
|
|
|
2045
|
-
export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps,
|
|
2028
|
+
export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps, ChatView, type ChatViewItem, type ChatViewProps, CheckSquareIcon, Checkbox, type CheckboxProps, ChevronLeftIcon, ChevronRightIcon, CloseIcon, Col, type ColOffset, type ColOrder, type ColProps, type ColSpan, ColorSwatch, type ColorSwatchProps, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, type ContainerSize, type Conversation, type ConversationTree, CrossSquareIcon, Divider, type DividerProps, Drawer, type DrawerPosition, type DrawerProps, EmptySquareIcon, ExpandIcon, type ExternalToolDefinition, FileChip, type FileChipProps, type FileChipStatus, HelperText, type HelperTextProps, HistoryIcon, HistoryPanel, type HistoryPanelProps, type IconProps, ImageCard, type ImageCardProps, Input, type InputAddonProps, type InputElementProps, InputGroup, type InputGroupProps, InputLeftAddon, InputLeftElement, type InputProps, InputRightAddon, InputRightElement, InputWrapper, type InputWrapperProps, Label, type LabelProps, LayersIcon, List, ListItem, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MarkdownContent, type MarkdownContentProps, MediaIcon, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, MenuTrigger, type MenuTriggerProps, Message, MessageActions, type MessageActionsConfig, type MessageActionsProps, type MessageActionsVariant, type MessageBranchInfo, type MessageNode, type MessageProps, type MessageVariant, Modal, type ModalProps, NODE_TYPES, Navbar, NavbarBrand, type NavbarBrandProps, NavbarContent, type NavbarContentProps, NavbarDivider, NavbarItem, type NavbarItemProps, NavbarLink, type NavbarLinkProps, type NavbarProps, type NodeType, Pagination, type PaginationProps, PdfCard, type PdfCardProps, PlusIcon, Popover, type PopoverAlign, type PopoverPosition, type PopoverProps, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Radio, type RadioProps, Row, type RowAlign, type RowGutter, type RowJustify, type RowProps, SCRIPT_ELEMENT_TYPES, ScriptCard, type ScriptCardProps, type ScriptElement, type ScriptElementType, SectionHeading, type SectionHeadingLevel, type SectionHeadingProps, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, SquareLoaderIcon, Stack, type StackDirection, type StackGap, type StackProps, type Step, type StepStatus, Stepper, type StepperProps, StreamingCursor, type StreamingCursorProps, Switch, type SwitchProps, TASK_STATUSES, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type Task, type TaskStatus, TextCard, type TextCardProps, Textarea, type TextareaProps, ThinkingIndicator, type ThinkingIndicatorProps, type ToastData, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, TodosList, type TodosListProps, type ToolDefinition, type ToolGroup, ToolPanelContainer, type ToolPanelContainerProps, type ToolPanelState, ToolSidebar, type ToolSidebarProps, Tooltip, type TooltipProps, type UseArtifactTreeNavigationReturn, type UseScrollAnchorOptions, type UseScrollAnchorReturn, type VideoAspectRatio, type VideoAspectRatioPreset, VideoCard, type VideoCardProps, addMessageToTree, areAllTasksSettled, createEmptyTree, createPreviewUrl, generateId, getActivePathMessages, getSiblingInfo, isBranchPoint, isImageFile, messagesToTree, revokePreviewUrl, switchBranch, updateNodeContent, useArtifactTreeNavigation, useResizable, useScrollAnchor, useToast, version };
|
package/dist/index.js
CHANGED
|
@@ -4658,14 +4658,13 @@ function addMessageToTree(tree, message, parentId = null) {
|
|
|
4658
4658
|
} else if (!parentId) {
|
|
4659
4659
|
branchIndex = newRootIds.length;
|
|
4660
4660
|
}
|
|
4661
|
-
|
|
4661
|
+
newNodes[message.id] = {
|
|
4662
4662
|
...message,
|
|
4663
4663
|
parentId,
|
|
4664
4664
|
children: [],
|
|
4665
4665
|
branchIndex,
|
|
4666
4666
|
createdAt: message.createdAt ?? Date.now()
|
|
4667
4667
|
};
|
|
4668
|
-
newNodes[message.id] = newNode;
|
|
4669
4668
|
if (parentId && newNodes[parentId]) {
|
|
4670
4669
|
newNodes[parentId] = {
|
|
4671
4670
|
...newNodes[parentId],
|
|
@@ -4741,8 +4740,7 @@ function switchBranch(tree, nodeId, direction) {
|
|
|
4741
4740
|
return tree;
|
|
4742
4741
|
}
|
|
4743
4742
|
const newIndex = direction === "next" ? (currentIndex + 1) % siblings.length : (currentIndex - 1 + siblings.length) % siblings.length;
|
|
4744
|
-
|
|
4745
|
-
let leafId = newNodeId;
|
|
4743
|
+
let leafId = siblings[newIndex];
|
|
4746
4744
|
let currentNode = tree.nodes[leafId];
|
|
4747
4745
|
while (currentNode && currentNode.children.length > 0) {
|
|
4748
4746
|
leafId = currentNode.children[0];
|
|
@@ -6942,19 +6940,13 @@ var ChatInterface = import_react78.default.forwardRef(
|
|
|
6942
6940
|
const isTreeMode = !!conversationTree;
|
|
6943
6941
|
const effectiveMessages = (0, import_react78.useMemo)(() => {
|
|
6944
6942
|
if (isTreeMode && conversationTree) {
|
|
6945
|
-
|
|
6946
|
-
return pathNodes.map((node) => ({
|
|
6947
|
-
id: node.id,
|
|
6948
|
-
variant: node.role,
|
|
6949
|
-
content: node.content,
|
|
6950
|
-
isStreaming: node.isStreaming
|
|
6951
|
-
}));
|
|
6943
|
+
return getActivePathMessages(conversationTree);
|
|
6952
6944
|
}
|
|
6953
|
-
return messages;
|
|
6945
|
+
return messages || [];
|
|
6954
6946
|
}, [isTreeMode, conversationTree, messages]);
|
|
6955
6947
|
const latestUserMessageIndex = (0, import_react78.useMemo)(() => {
|
|
6956
6948
|
for (let i = effectiveMessages.length - 1; i >= 0; i--) {
|
|
6957
|
-
if (effectiveMessages[i].
|
|
6949
|
+
if (effectiveMessages[i].role === "user") {
|
|
6958
6950
|
return i;
|
|
6959
6951
|
}
|
|
6960
6952
|
}
|
|
@@ -7011,10 +7003,23 @@ var ChatInterface = import_react78.default.forwardRef(
|
|
|
7011
7003
|
}
|
|
7012
7004
|
const actions = enableMessageActions ? {
|
|
7013
7005
|
showCopy: true,
|
|
7014
|
-
onEdit: msg.
|
|
7015
|
-
onRetry: msg.
|
|
7006
|
+
onEdit: msg.role === "user" && onEditMessage ? (newContent) => onEditMessage(msg.id, newContent) : void 0,
|
|
7007
|
+
onRetry: msg.role === "assistant" && onRetryMessage ? () => onRetryMessage(msg.id) : void 0
|
|
7016
7008
|
} : void 0;
|
|
7017
|
-
|
|
7009
|
+
const {
|
|
7010
|
+
role,
|
|
7011
|
+
parentId,
|
|
7012
|
+
children,
|
|
7013
|
+
branchIndex,
|
|
7014
|
+
createdAt,
|
|
7015
|
+
...rest2
|
|
7016
|
+
} = msg;
|
|
7017
|
+
return {
|
|
7018
|
+
...rest2,
|
|
7019
|
+
variant: role,
|
|
7020
|
+
branchInfo,
|
|
7021
|
+
actions
|
|
7022
|
+
};
|
|
7018
7023
|
});
|
|
7019
7024
|
}, [
|
|
7020
7025
|
effectiveMessages,
|