Skip to content

The open alternative to Salesforce, designed for AI.

548 B
Raw Blame
import { ChatReferenceChip } from '@/ai/components/ChatReferenceChip';
import { getChatReferenceSegments } from '@/ai/utils/getChatReferenceSegments';

type TextWithChatReferencesProps = {
  text: string;
};

export const TextWithChatReferences = ({
  text,
}: TextWithChatReferencesProps) => {
  return (
    <>
      {getChatReferenceSegments(text).map((segment) =>
        typeof segment === 'string' ? (
          segment
        ) : (
          <ChatReferenceChip key={segment.index} reference={segment} />
        ),
      )}
    </>
  );
};