open-swe/apps/web/src/components/thread/messages/interrupt.tsx

32 lines
899 B
TypeScript
Raw Normal View History

import { isAgentInboxInterruptSchema } from "@/lib/agent-inbox-interrupt";
import { ThreadView } from "../agent-inbox";
import { GenericInterruptView } from "./generic-interrupt";
interface InterruptProps {
interruptValue?: unknown;
isLastMessage: boolean;
hasNoAIOrToolMessages: boolean;
forceRenderInterrupt?: boolean;
}
export function Interrupt({
interruptValue,
isLastMessage,
hasNoAIOrToolMessages,
forceRenderInterrupt,
}: InterruptProps) {
return (
<>
{isAgentInboxInterruptSchema(interruptValue) &&
(isLastMessage || hasNoAIOrToolMessages || forceRenderInterrupt) && (
<ThreadView interrupt={interruptValue} />
)}
{interruptValue &&
!isAgentInboxInterruptSchema(interruptValue) &&
(isLastMessage || forceRenderInterrupt) ? (
<GenericInterruptView interrupt={interruptValue} />
) : null}
</>
);
}