Fix red X when Tavily MCP does not return error (#11227)

Co-authored-by: mamoodi <mamoodiha@gmail.com>
This commit is contained in:
Alex42006 2025-10-27 13:36:08 -04:00 committed by GitHub
parent eb616dfae4
commit 8f94b68ea1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,9 +17,19 @@ export const getObservationResult = (event: OpenHandsObservation) => {
case "run_ipython":
case "read":
case "edit":
case "mcp":
if (!hasContent || contentIncludesError) return "error";
return "success"; // Content is valid
return "success";
case "mcp":
try {
const parsed = JSON.parse(event.content);
if (typeof parsed?.isError === "boolean") {
return parsed.isError ? "error" : "success";
}
} catch {
return hasContent ? "success" : "error";
}
return hasContent ? "success" : "error";
default:
return "success";
}