From 5a55fd4d99a727c4a55c80520bd674ca1ec8c4eb Mon Sep 17 00:00:00 2001 From: Hylke Sijbesma Date: Thu, 17 Apr 2025 10:54:45 +0200 Subject: [PATCH] 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. --- src/components/thread/messages/ai.tsx | 121 ++++++++++++++------------ 1 file changed, 67 insertions(+), 54 deletions(-) diff --git a/src/components/thread/messages/ai.tsx b/src/components/thread/messages/ai.tsx index aeeb0ea..e86c821 100644 --- a/src/components/thread/messages/ai.tsx +++ b/src/components/thread/messages/ai.tsx @@ -114,64 +114,77 @@ export function AssistantMessage({ return (
- {isToolResult ? ( - - ) : ( -
- {contentString.length > 0 && ( -
- {contentString} -
- )} +
+ {isToolResult ? ( + <> + + {isAgentInboxInterruptSchema(threadInterrupt?.value) && + (isLastMessage || hasNoAIOrToolMessages) && ( + + )} + {threadInterrupt?.value && + !isAgentInboxInterruptSchema(threadInterrupt.value) && + isLastMessage ? ( + + ) : null} + + ) : ( + <> + {contentString.length > 0 && ( +
+ {contentString} +
+ )} - {!hideToolCalls && ( - <> - {(hasToolCalls && toolCallsHaveContents && ( - - )) || - (hasAnthropicToolCalls && ( - + {!hideToolCalls && ( + <> + {(hasToolCalls && toolCallsHaveContents && ( + )) || - (hasToolCalls && )} - - )} + (hasAnthropicToolCalls && ( + + )) || + (hasToolCalls && )} + + )} - {message && ( - - )} - {isAgentInboxInterruptSchema(threadInterrupt?.value) && - (isLastMessage || hasNoAIOrToolMessages) && ( - + {message && ( + )} - {threadInterrupt?.value && - !isAgentInboxInterruptSchema(threadInterrupt.value) && - isLastMessage ? ( - - ) : null} -
- thread.setBranch(branch)} - isLoading={isLoading} - /> - handleRegenerate(parentCheckpoint)} - /> -
-
- )} + {isAgentInboxInterruptSchema(threadInterrupt?.value) && + (isLastMessage || hasNoAIOrToolMessages) && ( + + )} + {threadInterrupt?.value && + !isAgentInboxInterruptSchema(threadInterrupt.value) && + isLastMessage ? ( + + ) : null} +
+ thread.setBranch(branch)} + isLoading={isLoading} + /> + handleRegenerate(parentCheckpoint)} + /> +
+ + )} +
); }