π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π style(conversation): render steered follow-ups as a standard user message (#21549)
AmAzing-8f501ced9e5f
diff --git a/scripts/stylexMigration/legacyFiles.json b/scripts/stylexMigration/legacyFiles.jsonindex 0fcd1a078c6..8038ee50aff 100644--- a/scripts/stylexMigration/legacyFiles.json+++ b/scripts/stylexMigration/legacyFiles.json@@ -630,7 +630,6 @@"src/features/Conversation/Messages/AssistantGroup/components/Group.tsx","src/features/Conversation/Messages/AssistantGroup/components/MessageContent.tsx","src/features/Conversation/Messages/AssistantGroup/components/ProcessFold.tsx",- "src/features/Conversation/Messages/AssistantGroup/components/SteerMessage.tsx","src/features/Conversation/Messages/CompressedGroup/index.tsx","src/features/Conversation/Messages/EditedFilesCard/index.tsx","src/features/Conversation/Messages/GoalTaskCard/PlanChain.tsx",diff --git a/src/features/Conversation/Messages/AssistantGroup/components/SteerMessage.tsx b/src/features/Conversation/Messages/AssistantGroup/components/SteerMessage.tsxindex a992a35692c..ff6da981baa 100644--- a/src/features/Conversation/Messages/AssistantGroup/components/SteerMessage.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/components/SteerMessage.tsx@@ -1,38 +1,35 @@-import { createStaticStyles, Flexbox, Tag } from '@lobehub/ui';-import isEqual from 'fast-deep-equal';+import { Flexbox } from '@lobehub/ui';import { memo } from 'react';-import { useTranslation } from 'react-i18next';import { dataSelectors, useConversationStore } from '../../../store';-import UserMessageContent from '../../User/components/MessageContent';+import UserMessage from '../../User';-const styles = createStaticStyles(({ css, cssVar }) => ({- bubble: css`- max-width: 100%;- padding-block: 8px;- padding-inline: 12px;- border-radius: 12px;-- background: ${cssVar.colorFillTertiary};- `,-}));+/**+ * Extra space around a steer bubble so it sits as far from the surrounding+ * turn output as a standalone user row does. A standalone row is separated+ * from the previous reply by that reply's action row (8px gap + 28px bar) and+ * both rows' block padding; inside the chain only the 4px chain gap exists.+ */+const STANDALONE_ROW_SPACING = 40;interface SteerMessageProps {id: string;}+/**+ * A queued follow-up rendered inside the turn it steered. It is the same user+ * row as a standalone message β avatar, title, bubble and the steer tag+ * (driven by `metadata.steer`) β with editing disabled: hovering it must not+ * claim the message action bar from the assistant turn that hosts it.+ */const SteerMessage = memo<SteerMessageProps>(({ id }) => {- const { t } = useTranslation('chat');- const item = useConversationStore(dataSelectors.getDisplayMessageById(id), isEqual);+ const exists = useConversationStore((s) => !!dataSelectors.getDisplayMessageById(id)(s));- if (!item) return null;+ if (!exists) return null;return (- <Flexbox align={'flex-end'} data-message-id={id} data-steer-message={id}>- <Flexbox align={'flex-start'} className={styles.bubble} gap={4}>- <Tag>{t('steer.tag')}</Tag>- <UserMessageContent {...item} />- </Flexbox>+ <Flexbox data-steer-message={id} paddingBlock={STANDALONE_ROW_SPACING}>+ <UserMessage disableEditing id={id} index={0} /></Flexbox>);});diff --git a/src/features/Conversation/Messages/User/index.tsx b/src/features/Conversation/Messages/User/index.tsxindex 46918e47561..45620cac896 100644--- a/src/features/Conversation/Messages/User/index.tsx+++ b/src/features/Conversation/Messages/User/index.tsx@@ -1,5 +1,5 @@import { agentDisplayName } from '@lobechat/types';-import { Tag } from '@lobehub/ui';+import { Flexbox, Tag } from '@lobehub/ui';import isEqual from 'fast-deep-equal';import { type MouseEventHandler } from 'react';import { memo, useCallback, useMemo } from 'react';@@ -119,6 +119,7 @@ const UserMessage = memo<UserMessageProps>(({ id, disableEditing, index }) => {belowMessage={<ScheduledRunFooter id={id} />}customAvatarRender={scmSource ? () => <ScmEventAvatar /> : undefined}editing={editing}+ headerAddon={scmSource ? <ScmEventSenderTitle source={scmSource} /> : undefined}id={id}message={content}messageExtra={<UserMessageExtra extra={extra} id={id} />}@@ -131,14 +132,6 @@ const UserMessage = memo<UserMessageProps>(({ id, disableEditing, index }) => {<MessageCommentBadge count={commentCount} messageId={id} topicId={commentTopicId} />) : undefined}- headerAddon={- scmSource || metadata?.steer ? (- <>- {scmSource && <ScmEventSenderTitle source={scmSource} />}- {metadata?.steer && <Tag>{t('steer.tag')}</Tag>}- </>- ) : undefined- }titleAddon={// The row is `row-reverse` (right-aligned), so `headerAddon` renders on// the far side of the author name. The source link belongs on the near@@ -163,7 +156,16 @@ const UserMessage = memo<UserMessageProps>(({ id, disableEditing, index }) => {onDoubleClick={onDoubleClick}onMouseEnter={onMouseEnter}>- <UserMessageContent {...item} />+ {metadata?.steer ? (+ // The steer tag labels the instruction itself, so it sits inside the+ // bubble rather than in the sender header.+ <Flexbox align={'flex-start'} gap={4}>+ <Tag>{t('steer.tag')}</Tag>+ <UserMessageContent {...item} />+ </Flexbox>+ ) : (+ <UserMessageContent {...item} />+ )}</ChatItem>);}, isEqual);