Fix zero state not showing for V1 conversations (#11452)

This commit is contained in:
sp.wack 2025-10-21 20:04:01 +04:00 committed by GitHub
parent 490d3dba10
commit fc9a87550d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 2 deletions

View File

@ -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],
);

View File

@ -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
*/