AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend/builder): hide seed message from chat UI
Zamil Majdy19c8aecb97e4
diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/BuilderChatPanel.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/BuilderChatPanel.tsxindex ae6e293497..cd763c5756 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/BuilderChatPanel.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/BuilderChatPanel.tsx@@ -34,6 +34,7 @@ export function BuilderChatPanel({ className, isGraphLoaded }: Props) {sessionId,nodes,parsedActions,+ seedMessageId,} = useBuilderChatPanel({ isGraphLoaded });const [inputValue, setInputValue] = useState("");@@ -90,6 +91,7 @@ export function BuilderChatPanel({ className, isGraphLoaded }: Props) {streamError={error}nodes={nodes}parsedActions={parsedActions}+ seedMessageId={seedMessageId}messagesEndRef={messagesEndRef}/>@@ -145,6 +147,7 @@ interface MessageListProps {streamError: Error | undefined;nodes: CustomNode[];parsedActions: GraphAction[];+ seedMessageId: string | null;messagesEndRef: React.RefObject<HTMLDivElement>;}@@ -155,10 +158,12 @@ function MessageList({streamError,nodes,parsedActions,+ seedMessageId,messagesEndRef,}: MessageListProps) {- const visibleMessages = messages.filter((msg) =>- Boolean(extractTextFromParts(msg.parts)),+ const visibleMessages = messages.filter(+ (msg) =>+ msg.id !== seedMessageId && Boolean(extractTextFromParts(msg.parts)),);return (diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/__tests__/BuilderChatPanel.test.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/__tests__/BuilderChatPanel.test.tsxindex aee47e7122..5c0401c410 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/__tests__/BuilderChatPanel.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/__tests__/BuilderChatPanel.test.tsx@@ -40,6 +40,7 @@ function makeMockHook(nodes: [],parsedActions: [],handleApplyAction: vi.fn(),+ seedMessageId: null,...overrides,};}diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/useBuilderChatPanel.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/useBuilderChatPanel.tsindex c7c169d016..7e6a96ad1c 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/useBuilderChatPanel.ts+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderChatPanel/useBuilderChatPanel.ts@@ -127,6 +127,13 @@ export function useBuilderChatPanel({sendMessageRef.current = sendMessage;handleApplyActionRef.current = handleApplyAction;+ // ID of the seed message sent on panel open. It contains prompt-engineering+ // instructions that should not be shown to the user.+ const seedMessageId = useMemo(() => {+ if (!hasSentSeedMessageRef.current) return null;+ return messages.find((m) => m.role === "user")?.id ?? null;+ }, [messages]);+// Parsed actions from the last assistant message. Gated on `status ===// "ready"` so the expensive regex parse only runs once per completed AI turn,// not on every streaming chunk.@@ -238,5 +245,6 @@ export function useBuilderChatPanel({nodes,parsedActions,handleApplyAction,+ seedMessageId,};}