Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Open page: fill the chat area down to the message box
luishron123cbd8a751bd3f
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsxindex d44ca61fbd..2d15ecbb11 100644--- a/src/components/ChatView.tsx+++ b/src/components/ChatView.tsx@@ -1226,7 +1226,7 @@ export const ChatView = memo(function ChatView({ bot: profile, inForkPanel = fal</div><TranscriptAnnouncer threadKey={transcriptKey} snapshot={announcement} />- <div ref={setPagePane} data-page-pane-slot className="contents" style={{ "--page-pane-bottom": `${composerDock.height}px` } as CSSProperties} />+ <div ref={setPagePane} data-page-pane-slot className="contents" style={{ "--page-pane-bottom": `${composerDock.box}px` } as CSSProperties} /><div ref={composerDockRef} className="pointer-events-none absolute inset-x-0 bottom-0 z-[2] chat-column-dock">{advanced && lastRunStep && showRun(recordedRun) && showRunCard && runDismissed.get(transcriptKey) !== lastRunStep.id && (diff --git a/src/lib/composer-dock.test.ts b/src/lib/composer-dock.test.tsindex 7b4314e6f1..3e9de7622d 100644--- a/src/lib/composer-dock.test.ts+++ b/src/lib/composer-dock.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from "vitest";-import { TRANSCRIPT_GAP, transcriptEndPad } from "./composer-dock";+import { messageBoxHeight, TRANSCRIPT_GAP, transcriptEndPad } from "./composer-dock";describe("transcriptEndPad", () => {it("adds one gap-3 of black above the measured composer", () => {@@ -20,3 +20,14 @@ describe("transcriptEndPad", () => {expect(transcriptEndPad(Number.NaN)).toBe("calc(64px + 0.75rem)");});});++describe("messageBoxHeight", () => {+ it("leaves out what is stacked above the message box, so an open page is not squeezed by attachments", () => {+ expect(messageBoxHeight({ bottom: 900 }, { top: 840 })).toBe(60);+ });++ it("is zero without a message box, and never negative", () => {+ expect(messageBoxHeight({ bottom: 900 }, undefined)).toBe(0);+ expect(messageBoxHeight({ bottom: 900 }, { top: 910 })).toBe(0);+ });+});diff --git a/src/lib/composer-dock.ts b/src/lib/composer-dock.tsindex 62a03e6b41..3a088ae4be 100644--- a/src/lib/composer-dock.ts+++ b/src/lib/composer-dock.ts@@ -12,17 +12,27 @@ export function transcriptEndPad(composerHeightPx: number): string {return `calc(${height}px + ${TRANSCRIPT_GAP})`;}+/** From the dock's bottom edge up to the top of the message box, leaving out the chips and attachments stacked above it. */+export function messageBoxHeight(dock: Pick<DOMRect, "bottom">, box: Pick<DOMRect, "top"> | undefined): number {+ return box ? Math.max(0, dock.bottom - box.top) : 0;+}+export function useComposerDockPad(ref: RefObject<HTMLElement | null>) {const [height, setHeight] = useState(0);+ const [box, setBox] = useState(0);useLayoutEffect(() => {const el = ref.current;if (!el) return;- const apply = () => setHeight(el.getBoundingClientRect().height);+ const apply = () => {+ const dock = el.getBoundingClientRect();+ setHeight(dock.height);+ setBox(messageBoxHeight(dock, el.querySelector("[data-look=composer]")?.getBoundingClientRect()));+ };apply();const observer = new ResizeObserver(apply);observer.observe(el);return () => observer.disconnect();}, [ref]);const measured = height > 0 ? height : FALLBACK_COMPOSER_PX;- return { pad: transcriptEndPad(measured), height: measured };+ return { pad: transcriptEndPad(measured), height: measured, box: box > 0 ? box : measured };}