fix: render interrupt after tool result
Fix GenericInterruptView not rendering after tool result followed by interrupt Previously, the GenericInterruptView failed to render when an interrupt occurred immediately after a tool result message.
This commit is contained in:
@@ -114,64 +114,77 @@ export function AssistantMessage({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="group mr-auto flex items-start gap-2">
|
<div className="group mr-auto flex items-start gap-2">
|
||||||
{isToolResult ? (
|
<div className="flex flex-col gap-2">
|
||||||
<ToolResult message={message} />
|
{isToolResult ? (
|
||||||
) : (
|
<>
|
||||||
<div className="flex flex-col gap-2">
|
<ToolResult message={message} />
|
||||||
{contentString.length > 0 && (
|
{isAgentInboxInterruptSchema(threadInterrupt?.value) &&
|
||||||
<div className="py-1">
|
(isLastMessage || hasNoAIOrToolMessages) && (
|
||||||
<MarkdownText>{contentString}</MarkdownText>
|
<ThreadView interrupt={threadInterrupt.value} />
|
||||||
</div>
|
)}
|
||||||
)}
|
{threadInterrupt?.value &&
|
||||||
|
!isAgentInboxInterruptSchema(threadInterrupt.value) &&
|
||||||
|
isLastMessage ? (
|
||||||
|
<GenericInterruptView interrupt={threadInterrupt.value} />
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{contentString.length > 0 && (
|
||||||
|
<div className="py-1">
|
||||||
|
<MarkdownText>{contentString}</MarkdownText>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{!hideToolCalls && (
|
{!hideToolCalls && (
|
||||||
<>
|
<>
|
||||||
{(hasToolCalls && toolCallsHaveContents && (
|
{(hasToolCalls && toolCallsHaveContents && (
|
||||||
<ToolCalls toolCalls={message.tool_calls} />
|
<ToolCalls toolCalls={message.tool_calls} />
|
||||||
)) ||
|
|
||||||
(hasAnthropicToolCalls && (
|
|
||||||
<ToolCalls toolCalls={anthropicStreamedToolCalls} />
|
|
||||||
)) ||
|
)) ||
|
||||||
(hasToolCalls && <ToolCalls toolCalls={message.tool_calls} />)}
|
(hasAnthropicToolCalls && (
|
||||||
</>
|
<ToolCalls toolCalls={anthropicStreamedToolCalls} />
|
||||||
)}
|
)) ||
|
||||||
|
(hasToolCalls && <ToolCalls toolCalls={message.tool_calls} />)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{message && (
|
{message && (
|
||||||
<CustomComponent
|
<CustomComponent
|
||||||
message={message}
|
message={message}
|
||||||
thread={thread}
|
thread={thread}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
{isAgentInboxInterruptSchema(threadInterrupt?.value) &&
|
|
||||||
(isLastMessage || hasNoAIOrToolMessages) && (
|
|
||||||
<ThreadView interrupt={threadInterrupt.value} />
|
|
||||||
)}
|
)}
|
||||||
{threadInterrupt?.value &&
|
{isAgentInboxInterruptSchema(threadInterrupt?.value) &&
|
||||||
!isAgentInboxInterruptSchema(threadInterrupt.value) &&
|
(isLastMessage || hasNoAIOrToolMessages) && (
|
||||||
isLastMessage ? (
|
<ThreadView interrupt={threadInterrupt.value} />
|
||||||
<GenericInterruptView interrupt={threadInterrupt.value} />
|
)}
|
||||||
) : null}
|
{threadInterrupt?.value &&
|
||||||
<div
|
!isAgentInboxInterruptSchema(threadInterrupt.value) &&
|
||||||
className={cn(
|
isLastMessage ? (
|
||||||
"mr-auto flex items-center gap-2 transition-opacity",
|
<GenericInterruptView interrupt={threadInterrupt.value} />
|
||||||
"opacity-0 group-focus-within:opacity-100 group-hover:opacity-100",
|
) : null}
|
||||||
)}
|
<div
|
||||||
>
|
className={cn(
|
||||||
<BranchSwitcher
|
"mr-auto flex items-center gap-2 transition-opacity",
|
||||||
branch={meta?.branch}
|
"opacity-0 group-focus-within:opacity-100 group-hover:opacity-100",
|
||||||
branchOptions={meta?.branchOptions}
|
)}
|
||||||
onSelect={(branch) => thread.setBranch(branch)}
|
>
|
||||||
isLoading={isLoading}
|
<BranchSwitcher
|
||||||
/>
|
branch={meta?.branch}
|
||||||
<CommandBar
|
branchOptions={meta?.branchOptions}
|
||||||
content={contentString}
|
onSelect={(branch) => thread.setBranch(branch)}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
isAiMessage={true}
|
/>
|
||||||
handleRegenerate={() => handleRegenerate(parentCheckpoint)}
|
<CommandBar
|
||||||
/>
|
content={contentString}
|
||||||
</div>
|
isLoading={isLoading}
|
||||||
</div>
|
isAiMessage={true}
|
||||||
)}
|
handleRegenerate={() => handleRegenerate(parentCheckpoint)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user