Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

fix(console): a person's reply reference sits under their name, as an agent's does

raullopez-sandbox5dc0a86f999b
diff --git a/console/apps/switch-console-desktop/src/renderer/features/chats/components/chat-timeline.tsx b/console/apps/switch-console-desktop/src/renderer/features/chats/components/chat-timeline.tsx
index 45c403209..236013ae7 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/chats/components/chat-timeline.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/chats/components/chat-timeline.tsx
@@ -295,7 +295,6 @@ export const ChatTimelineView = observer(function ChatTimelineView({
>
<PersonAvatar name={message.sender.name} />
<div className="flex max-w-[85%] min-w-0 flex-col items-start gap-1">
- {chip && <ThreadChipButton chip={chip} />}
<span className="flex items-center gap-1.5 text-xs">
<span className="font-medium text-foreground-muted">{message.sender.name}</span>
{isBridged(message) && (
@@ -304,6 +303,7 @@ export const ChatTimelineView = observer(function ChatTimelineView({
</span>
)}
</span>
+ {chip && <ThreadChipButton chip={chip} />}
<div className="min-w-0 rounded-2xl bg-background-1 px-4 py-2.5 text-sm leading-relaxed break-words whitespace-pre-wrap">
<MentionText body={message.body} agents={agents} serverId={serverId} />
</div>
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-view.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-view.test.ts
index 4dd0dc0e9..497809b52 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-view.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-view.test.ts
@@ -11,6 +11,10 @@ import type { ChatMessage } from '@shared/core/chats/chats';
vi.mock('@renderer/lib/ipc', () => ({ events: { on: vi.fn() }, rpc: {} }));
// The viewer is Alice.
vi.mock('@renderer/features/chats/stores/chats', () => ({ chatsStore: { userId: 'me' } }));
+vi.mock('@renderer/lib/stores/use-avatar-settings', () => ({
+ useAvatarSettings: () => ({ thirdPartyAvatarsEnabled: false }),
+ useThirdPartyAvatarsEnabled: () => false,
+}));
function message(seq: number, userId: string, name: string): ChatMessage {
return {
@@ -53,3 +57,36 @@ describe('ChatTimelineView', () => {
expect(html.match(/aria-label="Reply"/g)).toHaveLength(2);
});
});
+
+describe('ChatTimelineView thread replies', () => {
+ it('puts the reply reference under the sender and above the body, for agents and people alike', () => {
+ const timeline = new ChatTimeline('room-1', api);
+ timeline.apply(message(1, 'me', 'Alice'));
+ timeline.apply({
+ ...message(2, 'agent-user', 'helper'),
+ sender: { clientId: 'h', name: 'helper', kind: 'agent', agentId: 'a1', userId: null },
+ threadRootId: 'm1',
+ body: 'agent reply',
+ });
+ timeline.apply({ ...message(3, 'other', 'Bob'), threadRootId: 'm1', body: 'person reply' });
+ const html = renderToStaticMarkup(
+ createElement(ChatTimelineView, {
+ serverId: 's',
+ timeline,
+ agents: [],
+ activities: [],
+ onReply: () => {},
+ })
+ );
+ for (const [name, body] of [
+ ['>helper<', 'agent reply'],
+ ['>Bob<', 'person reply'],
+ ]) {
+ const from = html.indexOf(name);
+ const chip = html.indexOf('reply to', from);
+ expect(from).toBeGreaterThan(-1);
+ expect(chip).toBeGreaterThan(from);
+ expect(html.indexOf(body, from)).toBeGreaterThan(chip);
+ }
+ });
+});