diff --git a/src/apps/chat/AppChat.tsx b/src/apps/chat/AppChat.tsx index 8fa53cf78..84b48287d 100644 --- a/src/apps/chat/AppChat.tsx +++ b/src/apps/chat/AppChat.tsx @@ -353,7 +353,7 @@ export function AppChat() { }); }, []); - const handleConversationBranch = React.useCallback((srcConversationId: DConversationId, messageId: string | null): DConversationId | null => { + const handleConversationBranch = React.useCallback((srcConversationId: DConversationId, messageId: string | null, addSplitPane: boolean): DConversationId | null => { // clone data const branchedConversationId = branchConversation(srcConversationId, messageId); @@ -363,7 +363,7 @@ export function AppChat() { // replace/open a new pane with this showNextTitleChange.current = true; - if (!isMultiAddable) + if (addSplitPane && !isMultiAddable) handleOpenConversationInFocusedPane(branchedConversationId); else handleOpenConversationInSplitPane(branchedConversationId); diff --git a/src/apps/chat/components/ChatMessageList.tsx b/src/apps/chat/components/ChatMessageList.tsx index ae2350be7..8dc7d0498 100644 --- a/src/apps/chat/components/ChatMessageList.tsx +++ b/src/apps/chat/components/ChatMessageList.tsx @@ -44,7 +44,7 @@ export function ChatMessageList(props: { fitScreen: boolean, isMobile: boolean, isMessageSelectionMode: boolean, - onConversationBranch: (conversationId: DConversationId, messageId: string) => void, + onConversationBranch: (conversationId: DConversationId, messageId: string, addSplitPane: boolean) => void, onConversationExecuteHistory: (conversationId: DConversationId) => Promise, onTextDiagram: (diagramConfig: DiagramConfig | null) => void, onTextImagine: (conversationId: DConversationId, selectedText: string) => Promise, @@ -156,7 +156,7 @@ export function ChatMessageList(props: { }, [conversationId, props.conversationHandler]); const handleMessageBranch = React.useCallback((messageId: DMessageId) => { - conversationId && onConversationBranch(conversationId, messageId); + conversationId && onConversationBranch(conversationId, messageId, true); }, [conversationId, onConversationBranch]); const handleMessageTruncate = React.useCallback((messageId: DMessageId) => { diff --git a/src/apps/chat/components/layout-drawer/ChatDrawer.tsx b/src/apps/chat/components/layout-drawer/ChatDrawer.tsx index 66e753ed6..8e1888399 100644 --- a/src/apps/chat/components/layout-drawer/ChatDrawer.tsx +++ b/src/apps/chat/components/layout-drawer/ChatDrawer.tsx @@ -65,7 +65,7 @@ function ChatDrawer(props: { chatPanesConversationIds: DConversationId[], disableNewButton: boolean, onConversationActivate: (conversationId: DConversationId) => void, - onConversationBranch: (conversationId: DConversationId, messageId: string | null) => void, + onConversationBranch: (conversationId: DConversationId, messageId: string | null, addSplitPane: boolean) => void, onConversationNew: (forceNoRecycle: boolean) => void, onConversationsDelete: (conversationIds: DConversationId[], bypassConfirmation: boolean) => void, onConversationsExportDialog: (conversationId: DConversationId | null, exportAll: boolean) => void, diff --git a/src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx b/src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx index ab72e16e7..4ba43e6da 100644 --- a/src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx +++ b/src/apps/chat/components/layout-drawer/ChatDrawerItem.tsx @@ -3,13 +3,13 @@ import * as React from 'react'; import { Avatar, Box, IconButton, ListItem, ListItemButton, ListItemDecorator, Sheet, styled, Tooltip, Typography } from '@mui/joy'; import AutoFixHighIcon from '@mui/icons-material/AutoFixHigh'; import CloseRoundedIcon from '@mui/icons-material/CloseRounded'; +import CopyAllIcon from '@mui/icons-material/CopyAll'; import DeleteForeverIcon from '@mui/icons-material/DeleteForever'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import EditRoundedIcon from '@mui/icons-material/EditRounded'; import FileUploadOutlinedIcon from '@mui/icons-material/FileUploadOutlined'; import FolderIcon from '@mui/icons-material/Folder'; import FolderOutlinedIcon from '@mui/icons-material/FolderOutlined'; -import ForkRightIcon from '@mui/icons-material/ForkRight'; import TelegramIcon from '@mui/icons-material/Telegram'; import { SystemPurposeId, SystemPurposes } from '../../../../data'; @@ -80,7 +80,7 @@ function ChatDrawerItem(props: { showSymbols: boolean | 'gif', bottomBarBasis: number, onConversationActivate: (conversationId: DConversationId, closeMenu: boolean) => void, - onConversationBranch: (conversationId: DConversationId, messageId: string | null) => void, + onConversationBranch: (conversationId: DConversationId, messageId: string | null, addSplitPane: boolean) => void, onConversationDeleteNoConfirmation: (conversationId: DConversationId) => void, onConversationExport: (conversationId: DConversationId, exportAll: boolean) => void, onConversationFolderChange: (folderChangeRequest: FolderChangeRequest) => void, @@ -128,7 +128,7 @@ function ChatDrawerItem(props: { const handleConversationBranch = React.useCallback((event: React.MouseEvent) => { event.stopPropagation(); - conversationId && onConversationBranch(conversationId, null); + conversationId && onConversationBranch(conversationId, null, false /* no pane from Drawer duplicate */); }, [conversationId, onConversationBranch]); @@ -365,9 +365,9 @@ function ChatDrawerItem(props: { - + - + diff --git a/src/apps/chat/components/layout-menu/ChatAppMenuItems.tsx b/src/apps/chat/components/layout-menu/ChatAppMenuItems.tsx index e1f8f2c7b..2599481fe 100644 --- a/src/apps/chat/components/layout-menu/ChatAppMenuItems.tsx +++ b/src/apps/chat/components/layout-menu/ChatAppMenuItems.tsx @@ -36,7 +36,7 @@ export function ChatAppMenuItems(props: { disableItems: boolean, hasConversations: boolean, isMessageSelectionMode: boolean, - onConversationBranch: (conversationId: DConversationId, messageId: string | null) => void, + onConversationBranch: (conversationId: DConversationId, messageId: string | null, addSplitPane: boolean) => void, onConversationClear: (conversationId: DConversationId) => void, onConversationFlatten: (conversationId: DConversationId) => void, // onConversationNew: (forceNoRecycle: boolean) => void, @@ -80,7 +80,7 @@ export function ChatAppMenuItems(props: { const handleConversationBranch = (event: React.MouseEvent) => { closeMenu(event); - props.conversationId && props.onConversationBranch(props.conversationId, null); + props.conversationId && props.onConversationBranch(props.conversationId, null, true); }; const handleConversationFlatten = (event: React.MouseEvent) => { diff --git a/src/modules/aifn/flatten/FlattenerModal.tsx b/src/modules/aifn/flatten/FlattenerModal.tsx index ee0b15e9d..a9f9c6fcf 100644 --- a/src/modules/aifn/flatten/FlattenerModal.tsx +++ b/src/modules/aifn/flatten/FlattenerModal.tsx @@ -82,7 +82,7 @@ function encodeConversationAsUserMessage(userPrompt: string, messages: DMessage[ export function FlattenerModal(props: { conversationId: string | null, - onConversationBranch: (conversationId: DConversationId, messageId: string | null) => DConversationId | null, + onConversationBranch: (conversationId: DConversationId, messageId: string | null, addSplitPane: boolean) => DConversationId | null, onClose: () => void, }) { @@ -137,7 +137,7 @@ export function FlattenerModal(props: { if (!props.conversationId || !selectedStyle || !flattenedText) return; let newConversationId: string | null = props.conversationId; if (branch) - newConversationId = props.onConversationBranch(props.conversationId, null); + newConversationId = props.onConversationBranch(props.conversationId, null, false /* no pane from Flatter new */); if (newConversationId) { const ncHandler = ConversationsManager.getHandler(newConversationId); const newRootMessage = createDMessageTextContent('user', flattenedText);// [new chat] user:former chat summary