mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Fix think observation redundant rendering in frontend (#10409)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
parent
315d391414
commit
ef3e0c8dfe
@ -16,6 +16,8 @@ const COMMON_NO_RENDER_LIST: OpenHandsEventType[] = [
|
||||
|
||||
const ACTION_NO_RENDER_LIST: OpenHandsEventType[] = ["recall"];
|
||||
|
||||
const OBSERVATION_NO_RENDER_LIST: OpenHandsEventType[] = ["think"];
|
||||
|
||||
export const shouldRenderEvent = (
|
||||
event: OpenHandsAction | OpenHandsObservation,
|
||||
) => {
|
||||
@ -35,7 +37,10 @@ export const shouldRenderEvent = (
|
||||
return false;
|
||||
}
|
||||
|
||||
return !COMMON_NO_RENDER_LIST.includes(event.observation);
|
||||
const noRenderList = COMMON_NO_RENDER_LIST.concat(
|
||||
OBSERVATION_NO_RENDER_LIST,
|
||||
);
|
||||
return !noRenderList.includes(event.observation);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -117,7 +117,7 @@ export function EventMessage({
|
||||
}
|
||||
|
||||
if (hasObservationPair && isOpenHandsAction(event)) {
|
||||
if (hasThoughtProperty(event.args)) {
|
||||
if (hasThoughtProperty(event.args) && event.action !== "think") {
|
||||
return (
|
||||
<div>
|
||||
<ChatMessage
|
||||
@ -243,9 +243,11 @@ export function EventMessage({
|
||||
|
||||
return (
|
||||
<div>
|
||||
{isOpenHandsAction(event) && hasThoughtProperty(event.args) && (
|
||||
<ChatMessage type="agent" message={event.args.thought} />
|
||||
)}
|
||||
{isOpenHandsAction(event) &&
|
||||
hasThoughtProperty(event.args) &&
|
||||
event.action !== "think" && (
|
||||
<ChatMessage type="agent" message={event.args.thought} />
|
||||
)}
|
||||
|
||||
<GenericEventMessage
|
||||
title={getEventContent(event).title}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user