Beam: simplify a bit

This commit is contained in:
Enrico Ros
2024-04-12 03:42:43 -07:00
parent 2c6cc5ecec
commit 14041b6012
5 changed files with 13 additions and 6 deletions
+2
View File
@@ -11,6 +11,7 @@ export const GoodTooltip = (props: {
title: React.ReactNode,
placement?: 'top' | 'bottom' | 'top-start',
isError?: boolean, isWarning?: boolean,
arrow?: boolean,
usePlain?: boolean,
children: React.JSX.Element,
sx?: SxProps
@@ -19,6 +20,7 @@ export const GoodTooltip = (props: {
title={props.title}
placement={props.placement}
disableInteractive
arrow={props.arrow}
variant={(props.isError || props.isWarning) ? 'soft' : props.usePlain ? 'plain' : undefined}
color={props.isError ? 'danger' : props.isWarning ? 'warning' : undefined}
sx={{
+2 -1
View File
@@ -146,7 +146,8 @@ export function BeamFusionGrid(props: {
</Box> : (
<Typography level='body-sm'>
You need two or more replies for a {currentFactory?.shortLabel?.toLocaleLowerCase() ?? ''} merge.
{/*You need two or more replies for a {currentFactory?.shortLabel?.toLocaleLowerCase() ?? ''} merge.*/}
Waiting for multiple Beams.
</Typography>
)}
</BeamCard>
+3 -2
View File
@@ -81,7 +81,7 @@ export function BeamGatherPane(props: {
setCurrentGatherLlmId: state.setCurrentGatherLlmId,
})));
const [_, gatherLlmComponent, gatherLlmIcon] = useLLMSelect(
currentGatherLlmId, setCurrentGatherLlmId, props.isMobile ? '' : 'Merge Model', true,
currentGatherLlmId, setCurrentGatherLlmId, props.isMobile ? '' : 'Merge Model', true, !props.canGather,
);
// derived state
@@ -116,7 +116,7 @@ export function BeamGatherPane(props: {
</Typography>
<Typography level='body-sm' sx={{ whiteSpace: 'nowrap' }}>
{/* may merge or not (hasInputs) N replies.. put this in pretty messages */}
{props.canGather ? `Combine the ${props.raysReady} replies` : 'Two replies or more'}
{props.canGather ? `Combine the ${props.raysReady} replies` : /*'Fuse all replies'*/ ''}
</Typography>
</div>
<ScrollToBottomButton inline />
@@ -128,6 +128,7 @@ export function BeamGatherPane(props: {
<ButtonGroup
variant='outlined'
size='md'
disabled={!props.canGather}
// sx={{ boxShadow: isNoFactorySelected ? 'xs' : undefined }}
>
{FUSION_FACTORIES.map(factory => {
+1 -1
View File
@@ -30,7 +30,7 @@ function FusionControls(props: {
{/* LLM Icon */}
{!!props.llmVendorIcon && (
<GoodTooltip title={props.llmLabel}>
<GoodTooltip placement='top' arrow title={props.llmLabel}>
<Box sx={{ display: 'flex' }}>
<props.llmVendorIcon sx={{ fontSize: 'lg', my: 'auto' }} />
</Box>
@@ -8,6 +8,7 @@ import { ChatMessageMemo } from '../../../apps/chat/components/message/ChatMessa
import type { DMessage } from '~/common/state/store-chats';
import { BEAM_INVERT_BACKGROUND } from '../beam.config';
import { useModuleBeamStore } from '../store-module-beam';
const userMessageWrapperSx: SxProps = {
@@ -53,6 +54,8 @@ export function BeamScatterInput(props: {
// state
const [showHistoryMessage, setShowHistoryMessage] = React.useState(true);
// external state
const gatherShowPrompts = useModuleBeamStore(state => state.gatherShowPrompts);
// derived state
@@ -66,14 +69,14 @@ export function BeamScatterInput(props: {
// user message decorator
const userMessageDecorator = React.useMemo(() => {
return (showHistoryMessage && otherHistoryCount >= 1) ? (
return (showHistoryMessage && otherHistoryCount >= 1 && gatherShowPrompts) ? (
// <Chip color='primary' variant='outlined' endDecorator={<ChipDelete />} sx={{ my: 1 }}>
<Typography level='body-xs' sx={{ my: 1.5, opacity: 0.9 }} onClick={() => setShowHistoryMessage(on => !on)}>
... {otherHistoryCount === 1 ? (isFirstMessageSystem ? '1 system message' : '1 message') : `${otherHistoryCount} messages`} before this input ...
</Typography>
// </Chip>
) : null;
}, [isFirstMessageSystem, otherHistoryCount, showHistoryMessage]);
}, [gatherShowPrompts, isFirstMessageSystem, otherHistoryCount, showHistoryMessage]);
// skip rendering if no message