enricoros / big-AGI

Generative AI suite powered by state-of-the-art models and providing advanced AI/AGI functions. It features AI personas, AGI functions, multi-model chats, text-to-image, voice, response streaming, code highlighting and execution, PDF import, presets for developers, much more. Deploy on-prem or in the cloud.
https://big-agi.com
MIT License
5.43k stars 1.24k forks source link

[Idea] Button for Duplicate chat with answer beam (without closing the current beam window) #668

Open darthalex2014 opened 3 days ago

darthalex2014 commented 3 days ago

image Button for Duplicate chat with answer beam (without close current beam window)

During the generation of multiple answers in Beam, sometimes it's desirable to compare further chat responses with different Beam answers.

If you click "choose this message", it inserts one message into the chat and the beam window closes, and we lose all other answers.

I propose to create a "duplicate" button. This button would create a duplicate of the current chat and insert the selected beam answer into it, without closing the current window with all the beam answers.

enricoros commented 2 days ago

Great idea @darthalex2014. This is in addition to the change I made for "multi-part" Add To Chat, which is already very precious and you suggested:

image

Tell me more about this request

darthalex2014 commented 2 days ago
  • when you click this new button, what happens to the underlying chat: a new message is added, or the whole chat is branched (duplicated to a full new conversation) Need a bit more detail to envision the workflow.

Currently, we have Chat 1 open. In it, a beam search is running, which has produced 8 responses. We click on response number 2 to duplicate it. Chat 1 with the beam search remains open (the beam also remains active), but the entire Chat 1 is duplicated into Chat 2, and response number 2 is inserted there. (We remain in Chat 1 within the beam search window).

enricoros commented 2 days ago

@darthalex2014 something like this? image

Need to evaluate tradeoffs of the UI and implement the logic part.

For reference, the following was the quick/dirty code hack:

Index: src/modules/beam/scatter/BeamRay.tsx
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/modules/beam/scatter/BeamRay.tsx b/src/modules/beam/scatter/BeamRay.tsx
--- a/src/modules/beam/scatter/BeamRay.tsx  (revision 72b0e7716862d0ef989ef8d24458b513a42d7963)
+++ b/src/modules/beam/scatter/BeamRay.tsx  (date 1729877495484)
@@ -1,9 +1,10 @@
 import * as React from 'react';

 import type { SxProps } from '@mui/joy/styles/types';
-import { Box, IconButton, SvgIconProps, Typography } from '@mui/joy';
+import { Box, Button, IconButton, SvgIconProps, Typography } from '@mui/joy';
 import CheckCircleOutlineRoundedIcon from '@mui/icons-material/CheckCircleOutlineRounded';
 import ContentCopyIcon from '@mui/icons-material/ContentCopy';
+import CopyAllIcon from '@mui/icons-material/CopyAll';
 import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
 import PlayArrowRoundedIcon from '@mui/icons-material/PlayArrowRounded';
 import RemoveCircleOutlineRoundedIcon from '@mui/icons-material/RemoveCircleOutlineRounded';
@@ -28,6 +29,7 @@
 import { rayIsError, rayIsImported, rayIsScattering, rayIsSelectable, rayIsUserSelected } from './beam.scatter';
 import { useBeamCardScrolling, useBeamScatterShowLettering } from '../store-module-beam';
 import { useMessageAvatarLabel } from '~/common/util/dMessageUtils';
+import ForkRightIcon from '@mui/icons-material/ForkRight';

 /*const letterSx: SxProps = {
@@ -260,27 +262,49 @@
             gap: 1,
           }}>

+            {/* Duplicate */}
+            {!isImported && (
+              <GoodTooltip title='Duplicate chat and add'>
+                <Button
+                  size='sm'
+                  variant='plain'
+                  color='neutral'
+                  onClick={handleRayCopyToClipboard}
+                  endDecorator={<ForkRightIcon sx={{ fontSize: 'md' }} />}
+                  sx={{ fontSize: 'xs', whiteSpace: 'nowrap' }}
+                >
+                  As new chat
+                </Button>
+              </GoodTooltip>
+            )}
+
+
             {/* Copy */}
             {!isImported && (
               <GoodTooltip title='Copy'>
-                <IconButton
+                <Button
                   size='sm'
+                  variant='plain'
+                  color='neutral'
                   onClick={handleRayCopyToClipboard}
+                  endDecorator={<ContentCopyIcon sx={{ fontSize: 'md' }} />}
+                  sx={{ fontSize: 'xs' }}
                 >
-                  <ContentCopyIcon sx={{ fontSize: 'md' }} />
-                </IconButton>
+                  Copy
+                </Button>
               </GoodTooltip>
             )}

             {/* Continue */}
             <GoodTooltip title='Choose this message'>
-              <IconButton
+              <Button
                 size='sm'
-                // variant='plain'
+                variant='plain'
                 color={GATHER_COLOR}
                 disabled={isImported || isScattering}
                 onClick={handleRayUse}
                 // endDecorator={!isImported ? <TelegramIcon /> : null}
+                endDecorator={<TelegramIcon />}
                 sx={{
                   fontSize: 'xs',
                   // '--Icon-fontSize': 'var(--joy-fontSize-xl)',
@@ -289,8 +313,9 @@
                   whiteSpace: 'nowrap',
                 }}
               >
-                {isImported ? 'From Chat (copied)' : /*props.hadImportedRays ? 'Replace' : 'Use'*/ <TelegramIcon />}
-              </IconButton>
+
+                {isImported ? 'From Chat (copied)' : /*props.hadImportedRays ? 'Replace' : 'Use'*/ 'Pick this'}
+              </Button>
             </GoodTooltip>

           </Box>
darthalex2014 commented 2 days ago

@darthalex2014 something like this?

yes!