The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { assertUnreachable } from 'twenty-shared/utils';
import { AiChatFormCard } from '@/ai/components/AiChatFormCard';
import { AiChatQuestionCard } from '@/ai/components/AiChatQuestionCard';
import { AiChatToolCallApprovalCard } from '@/ai/components/AiChatToolCallApprovalCard';
import { type AgentChatPendingToolCall } from '@/ai/types/AgentChatPendingToolCall';
type AiChatAskCardProps = {
pendingToolCall: AgentChatPendingToolCall;
isActive?: boolean;
};
export const AiChatAskCard = ({
pendingToolCall,
isActive = true,
}: AiChatAskCardProps) => {
switch (pendingToolCall.kind) {
case 'question':
case 'questions':
return <AiChatQuestionCard pendingQuestion={pendingToolCall} />;
case 'form':
return (
<AiChatFormCard
toolCallId={pendingToolCall.toolCallId}
fields={pendingToolCall.fields}
/>
);
case 'toolCallApproval':
return (
<AiChatToolCallApprovalCard
toolCallId={pendingToolCall.toolCallId}
proposal={pendingToolCall.proposal}
isActive={isActive}
/>
);
default:
return assertUnreachable(pendingToolCall);
}
};