@@ -65,6 +65,32 @@ function parseAnthropicStreamedToolCalls(
65
65
} ) ;
66
66
}
67
67
68
+ interface InterruptProps {
69
+ interruptValue ?: unknown ;
70
+ isLastMessage : boolean ;
71
+ hasNoAIOrToolMessages : boolean ;
72
+ }
73
+
74
+ function Interrupt ( {
75
+ interruptValue,
76
+ isLastMessage,
77
+ hasNoAIOrToolMessages,
78
+ } : InterruptProps ) {
79
+ return (
80
+ < >
81
+ { isAgentInboxInterruptSchema ( interruptValue ) &&
82
+ ( isLastMessage || hasNoAIOrToolMessages ) && (
83
+ < ThreadView interrupt = { interruptValue } />
84
+ ) }
85
+ { interruptValue &&
86
+ ! isAgentInboxInterruptSchema ( interruptValue ) &&
87
+ isLastMessage ? (
88
+ < GenericInterruptView interrupt = { interruptValue } />
89
+ ) : null }
90
+ </ >
91
+ ) ;
92
+ }
93
+
68
94
export function AssistantMessage ( {
69
95
message,
70
96
isLoading,
@@ -118,15 +144,11 @@ export function AssistantMessage({
118
144
{ isToolResult ? (
119
145
< >
120
146
< ToolResult message = { message } />
121
- { isAgentInboxInterruptSchema ( threadInterrupt ?. value ) &&
122
- ( isLastMessage || hasNoAIOrToolMessages ) && (
123
- < ThreadView interrupt = { threadInterrupt . value } />
124
- ) }
125
- { threadInterrupt ?. value &&
126
- ! isAgentInboxInterruptSchema ( threadInterrupt . value ) &&
127
- isLastMessage ? (
128
- < GenericInterruptView interrupt = { threadInterrupt . value } />
129
- ) : null }
147
+ < Interrupt
148
+ interruptValue = { threadInterrupt ?. value }
149
+ isLastMessage = { isLastMessage }
150
+ hasNoAIOrToolMessages = { hasNoAIOrToolMessages }
151
+ />
130
152
</ >
131
153
) : (
132
154
< >
@@ -144,7 +166,9 @@ export function AssistantMessage({
144
166
( hasAnthropicToolCalls && (
145
167
< ToolCalls toolCalls = { anthropicStreamedToolCalls } />
146
168
) ) ||
147
- ( hasToolCalls && < ToolCalls toolCalls = { message . tool_calls } /> ) }
169
+ ( hasToolCalls && (
170
+ < ToolCalls toolCalls = { message . tool_calls } />
171
+ ) ) }
148
172
</ >
149
173
) }
150
174
@@ -154,15 +178,11 @@ export function AssistantMessage({
154
178
thread = { thread }
155
179
/>
156
180
) }
157
- { isAgentInboxInterruptSchema ( threadInterrupt ?. value ) &&
158
- ( isLastMessage || hasNoAIOrToolMessages ) && (
159
- < ThreadView interrupt = { threadInterrupt . value } />
160
- ) }
161
- { threadInterrupt ?. value &&
162
- ! isAgentInboxInterruptSchema ( threadInterrupt . value ) &&
163
- isLastMessage ? (
164
- < GenericInterruptView interrupt = { threadInterrupt . value } />
165
- ) : null }
181
+ < Interrupt
182
+ interruptValue = { threadInterrupt ?. value }
183
+ isLastMessage = { isLastMessage }
184
+ hasNoAIOrToolMessages = { hasNoAIOrToolMessages }
185
+ />
166
186
< div
167
187
className = { cn (
168
188
"mr-auto flex items-center gap-2 transition-opacity" ,
0 commit comments