Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.7 KB
Raw Blame
import * as stylex from '@stylexjs/stylex';
import { memo } from 'react';

import Intervention from '../Messages/AssistantGroup/Tool/Detail/Intervention';
import { type PendingIntervention } from '../store/slices/data/pendingInterventions';
import { styles } from './style';
import UserInterventionErrorBoundary from './UserInterventionErrorBoundary';

interface InterventionContentProps {
  actionsPortalTarget: HTMLDivElement | null;
  intervention: PendingIntervention;
}

const InterventionContent = memo<InterventionContentProps>(
  ({ intervention, actionsPortalTarget }) => {
    const boundaryKey = [
      intervention.apiName,
      intervention.identifier,
      intervention.requestArgs,
      intervention.toolCallId,
      intervention.toolMessageId,
    ].join('|');

    return (
      <div {...stylex.props(styles.content)}>
        <UserInterventionErrorBoundary
          actionsPortalTarget={actionsPortalTarget}
          apiName={intervention.apiName}
          assistantGroupId={intervention.assistantGroupId}
          identifier={intervention.identifier}
          key={boundaryKey}
          requestArgs={intervention.requestArgs}
          toolCallId={intervention.toolCallId}
          toolMessageId={intervention.toolMessageId}
        >
          <Intervention
            actionsPortalTarget={actionsPortalTarget}
            apiName={intervention.apiName}
            assistantGroupId={intervention.assistantGroupId}
            id={intervention.toolMessageId}
            identifier={intervention.identifier}
            requestArgs={intervention.requestArgs}
            toolCallId={intervention.toolCallId}
          />
        </UserInterventionErrorBoundary>
      </div>
    );
  },
);

export default InterventionContent;