diff --git a/src/components/thread/messages/ai.tsx b/src/components/thread/messages/ai.tsx index aeeb0ea..b092431 100644 --- a/src/components/thread/messages/ai.tsx +++ b/src/components/thread/messages/ai.tsx @@ -65,6 +65,32 @@ function parseAnthropicStreamedToolCalls( }); } +interface InterruptProps { + interruptValue?: unknown; + isLastMessage: boolean; + hasNoAIOrToolMessages: boolean; +} + +function Interrupt({ + interruptValue, + isLastMessage, + hasNoAIOrToolMessages, +}: InterruptProps) { + return ( + <> + {isAgentInboxInterruptSchema(interruptValue) && + (isLastMessage || hasNoAIOrToolMessages) && ( + + )} + {interruptValue && + !isAgentInboxInterruptSchema(interruptValue) && + isLastMessage ? ( + + ) : null} + + ); +} + export function AssistantMessage({ message, isLoading, @@ -114,64 +140,71 @@ export function AssistantMessage({ return (
- {isToolResult ? ( - - ) : ( -
- {contentString.length > 0 && ( -
- {contentString} -
- )} +
+ {isToolResult ? ( + <> + + + + ) : ( + <> + {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)} - /> -
-
- )} +
+ thread.setBranch(branch)} + isLoading={isLoading} + /> + handleRegenerate(parentCheckpoint)} + /> +
+ + )} +
); }