Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Keep the chat view at its size limit: the teammate label lives beside the room label

Bugfixer 22bfef922ce02
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsx
index 20cf376f07..9ff2d45cc7 100644
--- a/src/components/ChatView.tsx
+++ b/src/components/ChatView.tsx
@@ -49,12 +49,11 @@ import { isCancelledTranscriptRow, PERSON_STOPPED_TURN_NAME } from "../../shared
import { stopNoticeDue, useStoppedAt } from "@/lib/stop-turn";
import { THIS_COMPUTER_NOT_READY } from "../../shared/your-computer";
import { BotAvatar } from "./Avatar";
-import { ClusterLabel } from "./RoomClusterLabel";
import { TurnPresence } from "./TurnPresence";
import { showToolCallsEnabled } from "@/lib/feature-flags";
import { stateForBot } from "@/lib/mascot";
import { flatPreview, peerLine, peerPreview, peerRequest } from "@/lib/peer-message"; import { PeerCompactRow, PeerLabel, PeerMessagesContext, PeerOpenedActions } from "./PeerExchange"; import { earlierAnswers } from "@/lib/check-rounds";
-import { lastRequests } from "@/lib/automation-note"; import { automationNoteRow } from "./AutomationNoteRow";
+import { lastRequests } from "@/lib/automation-note"; import { automationNoteRow } from "./AutomationNoteRow"; import { TeammateNamed } from "./RoomClusterLabel";
import { showWorkingDots } from "@/lib/turn-tail";
import { lastNonReceipt } from "@/lib/receipts";
import { useTurnLive } from "@/state/turn-status"; import { isLiveReply, StreamingReplyContext, streamedReply, useHasLiveReply, useLiveRow, useLiveTranscriptLayout } from "@/state/live-reply"; import { useTurnNow } from "./NowCard"; import { useThreadRoutineRun } from "@/state/older-routine-runs";
@@ -687,10 +686,8 @@ const MessagesList = memo(function MessagesList({
const peer = peerLine(m) ?? peerRequest(m, botId);
const user = m.role === "user" && !peer;
if (!user && isPureLeakedSystemHarnessMessage(m.text) && !m.attachments?.length) return null;
- // A teammate the person tagged here answers in its own name (server/tagged-answer.ts).
- const teammate = m.role === "bot" && m.from && m.from.botId !== botId ? m.from : undefined;
- const bubble = (
- <Bubble
+ return (
+ <TeammateNamed message={m} botId={botId} bots={bots}><Bubble
message={m}
emerging={m.id === emergingId}
eagerAttachments={m.id === newestMessageId || m.id === newestUserMessageId}
@@ -706,11 +703,8 @@ const MessagesList = memo(function MessagesList({
onRegenerate={m.id === lastBotTextId && !m.automation && canRetryLast ? onRegenerate : undefined}
replyTarget={lookups.replyTarget(m)}
onReply={onReply} forked={forked.has(m.id)} earlierRound={earlier.get(m.id)}
- />
+ /></TeammateNamed>
);
- return teammate
- ? <><ClusterLabel bot={bots.find((one) => one.id === teammate.botId)} name={teammate.name} color={teammate.color} />{bubble}</>
- : bubble;
}
}
})();
diff --git a/src/components/RoomClusterLabel.tsx b/src/components/RoomClusterLabel.tsx
index 6848eacff2..884396dc49 100644
--- a/src/components/RoomClusterLabel.tsx
+++ b/src/components/RoomClusterLabel.tsx
@@ -1,11 +1,11 @@
-import { Fragment, memo } from "react";
+import { Fragment, memo, type ReactNode } from "react";
import { BotAvatar } from "./Avatar";
import { cn } from "@/lib/cn";
import { sameDrawnBots } from "@/lib/drawn-bots";
import { MAUS_COLOR_NAMES, normalizeState, type MausColor } from "@/lib/mascot";
import type { RoomAddressee } from "@/lib/room-addressees";
-import type { Bot } from "@/state/store";
+import type { Bot, Message } from "@/state/store";
function isPaletteColor(color: string | undefined): color is MausColor {
return (MAUS_COLOR_NAMES as readonly string[]).includes(color ?? "");
@@ -66,3 +66,9 @@ export const ClusterLabel = memo(function ClusterLabel({ bot, name, color, to =
</div>
);
}, sameLabel);
+
+/** A reply another bot wrote in this bot's chat (a teammate the person tagged here) shows that bot's name above it. */
+export function TeammateNamed({ message, botId, bots, children }: { message: Message; botId: string; bots: readonly Bot[]; children: ReactNode }) {
+ const from = message.role === "bot" && message.from?.botId !== botId ? message.from : undefined;
+ return from ? <><ClusterLabel bot={bots.find((one) => one.id === from.botId)} name={from.name} color={from.color} />{children}</> : children;
+}