Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
darthalex2014 opened this issue Oct 24, 2024 · 5 comments

Comments

@darthalex2014
Copy link

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
Copy link
Owner

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

  • 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.

@darthalex2014
Copy link
Author

  • 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
Copy link
Owner

@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
Copy link
Author

@darthalex2014 something like this?

yes!

@enricoros
Copy link
Owner

enricoros commented Oct 30, 2024

@darthalex2014 - this is a great idea. Done and works well, I see why you ask for it; it's great to fork-off variants to then re-explore. It's not available to the public yet as I'm preparing Big-AGI 2, but will be soon.

Screenshot below, and it's working well. Let me know if you have other GREAT IDEAS!

image

In addition, you also get a visual indication of the branch history & auto retitle, so it's easier to continue with the new train of thought.

image

Works on both beams and merges.

What's next @darthalex2014 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants