mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Fix vscode url fetch regression (#5632)
This commit is contained in:
parent
b295f5775c
commit
dd79acdae1
@ -6,6 +6,7 @@ import ActionType from "#/types/action-type";
|
||||
import EventLogger from "#/utils/event-logger";
|
||||
import { handleAssistantMessage } from "#/services/actions";
|
||||
import { useRate } from "#/hooks/use-rate";
|
||||
import AgentState from "#/types/agent-state";
|
||||
|
||||
const isOpenHandsMessage = (event: Record<string, unknown>) =>
|
||||
event.action === "message";
|
||||
@ -102,6 +103,11 @@ export function WsClientProvider({
|
||||
lastEventRef.current = event;
|
||||
}
|
||||
|
||||
const extras = event.extras as Record<string, unknown>;
|
||||
if (extras?.agent_state === AgentState.INIT) {
|
||||
setStatus(WsClientProviderStatus.ACTIVE);
|
||||
}
|
||||
|
||||
if (
|
||||
status !== WsClientProviderStatus.ACTIVE &&
|
||||
event?.observation === "error"
|
||||
@ -110,10 +116,6 @@ export function WsClientProvider({
|
||||
return;
|
||||
}
|
||||
|
||||
if (status !== WsClientProviderStatus.ACTIVE) {
|
||||
setStatus(WsClientProviderStatus.ACTIVE);
|
||||
}
|
||||
|
||||
if (!event.token) {
|
||||
handleAssistantMessage(event);
|
||||
}
|
||||
|
||||
@ -84,8 +84,11 @@ async def init_connection(
|
||||
):
|
||||
continue
|
||||
elif isinstance(event, AgentStateChangedObservation):
|
||||
agent_state_changed = event
|
||||
continue
|
||||
if event.agent_state == 'init':
|
||||
await sio.emit('oh_event', event_to_dict(event), to=connection_id)
|
||||
else:
|
||||
agent_state_changed = event
|
||||
continue
|
||||
await sio.emit('oh_event', event_to_dict(event), to=connection_id)
|
||||
if agent_state_changed:
|
||||
await sio.emit('oh_event', event_to_dict(agent_state_changed), to=connection_id)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user