mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
Disambiguate Clone and Branch
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<void>,
|
||||
onTextDiagram: (diagramConfig: DiagramConfig | null) => void,
|
||||
onTextImagine: (conversationId: DConversationId, selectedText: string) => Promise<void>,
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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: {
|
||||
</FadeInButton>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip disableInteractive title='Duplicate (Branch)'>
|
||||
<Tooltip disableInteractive title='Duplicate'>
|
||||
<FadeInButton size='sm' onClick={handleConversationBranch}>
|
||||
<ForkRightIcon />
|
||||
<CopyAllIcon />
|
||||
</FadeInButton>
|
||||
</Tooltip>
|
||||
|
||||
|
||||
@@ -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<HTMLDivElement>) => {
|
||||
closeMenu(event);
|
||||
props.conversationId && props.onConversationBranch(props.conversationId, null);
|
||||
props.conversationId && props.onConversationBranch(props.conversationId, null, true);
|
||||
};
|
||||
|
||||
const handleConversationFlatten = (event: React.MouseEvent<HTMLElement>) => {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user