From c6e29e0166d2417e480d33aa614f2e7315c9f83f Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Thu, 19 Jun 2025 16:08:06 -0700 Subject: [PATCH] fix: Account for when tool call args are not properly formatted (#277) * fix: Account for when tool call args are not properly formatted * cr --- apps/web/src/components/gen-ui/action-step.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/gen-ui/action-step.tsx b/apps/web/src/components/gen-ui/action-step.tsx index cfc05988..095fd739 100644 --- a/apps/web/src/components/gen-ui/action-step.tsx +++ b/apps/web/src/components/gen-ui/action-step.tsx @@ -141,6 +141,21 @@ export function ActionStep(props: ActionStepProps) { } if (props.actionType === "shell") { + let commandStr = ""; + if (props.command) { + if (Array.isArray(props.command)) { + commandStr = props.command.join(" "); + } else if ( + typeof props.command === "string" && + (props.command as string).length > 0 + ) { + try { + commandStr = JSON.parse(props.command); + } catch { + commandStr = props.command; + } + } + } return (
{props.workdir && ( @@ -149,7 +164,7 @@ export function ActionStep(props: ActionStepProps) {
)} - {props.command?.join(" ")} + {commandStr} );