mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Fix zero state not showing for V1 conversations (#11452)
This commit is contained in:
parent
490d3dba10
commit
fc9a87550d
@ -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],
|
||||
);
|
||||
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user