diff --git a/frontend/src/components/features/chat/chat-interface.tsx b/frontend/src/components/features/chat/chat-interface.tsx index 56ab3361bb..83a545f247 100644 --- a/frontend/src/components/features/chat/chat-interface.tsx +++ b/frontend/src/components/features/chat/chat-interface.tsx @@ -40,7 +40,12 @@ import { useConfig } from "#/hooks/query/use-config"; import { validateFiles } from "#/utils/file-validation"; import { useConversationStore } from "#/state/conversation-store"; import ConfirmationModeEnabled from "./confirmation-mode-enabled"; -import { isV0Event, isV1Event } from "#/types/v1/type-guards"; +import { + isV0Event, + isV1Event, + isSystemPromptEvent, + isConversationStateUpdateEvent, +} from "#/types/v1/type-guards"; import { useActiveConversation } from "#/hooks/query/use-active-conversation"; function getEntryPoint( @@ -111,7 +116,14 @@ export function ChatInterface() { event.source === "agent" && event.action !== "system", ) || - storeEvents.filter(isV1Event).some((event) => event.source === "agent"), + storeEvents + .filter(isV1Event) + .some( + (event) => + event.source === "agent" && + !isSystemPromptEvent(event) && + !isConversationStateUpdateEvent(event), + ), [storeEvents], ); diff --git a/frontend/src/types/v1/type-guards.ts b/frontend/src/types/v1/type-guards.ts index 1d3973cfa6..7add42ef71 100644 --- a/frontend/src/types/v1/type-guards.ts +++ b/frontend/src/types/v1/type-guards.ts @@ -13,6 +13,7 @@ import { ConversationStateUpdateEventAgentStatus, ConversationStateUpdateEventFullState, } from "./core/events/conversation-state-event"; +import { SystemPromptEvent } from "./core/events/system-event"; import type { OpenHandsParsedEvent } from "../core/index"; /** @@ -108,6 +109,18 @@ export const isExecuteBashObservationEvent = ( isObservationEvent(event) && event.observation.kind === "ExecuteBashObservation"; +/** + * Type guard function to check if an event is a system prompt event + */ +export const isSystemPromptEvent = ( + event: OpenHandsEvent, +): event is SystemPromptEvent => + event.source === "agent" && + "system_prompt" in event && + "tools" in event && + typeof event.system_prompt === "object" && + Array.isArray(event.tools); + /** * Type guard function to check if an event is a conversation state update event */