From a0e9d7f5f316e715681bf97ee161afabd4591b02 Mon Sep 17 00:00:00 2001 From: bracesproul Date: Mon, 17 Mar 2025 14:09:04 -0700 Subject: [PATCH] fix: Allow for human interrupt to be passed without array --- .../components/thread-actions-view.tsx | 19 ++++++++++------- src/components/thread/agent-inbox/index.tsx | 7 ++++--- src/components/thread/messages/ai.tsx | 2 +- src/lib/agent-inbox-interrupt.ts | 21 ++++++++++--------- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/components/thread/agent-inbox/components/thread-actions-view.tsx b/src/components/thread/agent-inbox/components/thread-actions-view.tsx index a0fe53a..096f5e7 100644 --- a/src/components/thread/agent-inbox/components/thread-actions-view.tsx +++ b/src/components/thread/agent-inbox/components/thread-actions-view.tsx @@ -100,6 +100,7 @@ export function ThreadActionsView({ const threadTitle = interrupt.action_request.action || "Unknown"; const actionsDisabled = loading || streaming; + const ignoreAllowed = interrupt.config.allow_ignore; return (
@@ -138,14 +139,16 @@ export function ThreadActionsView({ > Mark as Resolved - + {ignoreAllowed && ( + + )}
{/* Actions */} diff --git a/src/components/thread/agent-inbox/index.tsx b/src/components/thread/agent-inbox/index.tsx index 141bba1..2bbd614 100644 --- a/src/components/thread/agent-inbox/index.tsx +++ b/src/components/thread/agent-inbox/index.tsx @@ -5,10 +5,11 @@ import { HumanInterrupt } from "@langchain/langgraph/prebuilt"; import { useStreamContext } from "@/providers/Stream"; interface ThreadViewProps { - interrupt: HumanInterrupt; + interrupt: HumanInterrupt | HumanInterrupt[]; } export function ThreadView({ interrupt }: ThreadViewProps) { + const interruptObj = Array.isArray(interrupt) ? interrupt[0] : interrupt; const thread = useStreamContext(); const [showDescription, setShowDescription] = useState(false); const [showState, setShowState] = useState(false); @@ -39,13 +40,13 @@ export function ThreadView({ interrupt }: ThreadViewProps) { {showSidePanel ? ( ) : ( {isAgentInboxInterruptSchema(interrupt?.value) && isLastMessage && ( - + )}