mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-29 22:05:18 +01:00
34 lines
893 B
TypeScript
34 lines
893 B
TypeScript
import { memo } from 'react';
|
|
import type { TMessageContentParts } from 'librechat-data-provider';
|
|
import Part from './Part';
|
|
|
|
type ContentPartsProps = {
|
|
content: Array<TMessageContentParts | undefined>;
|
|
messageId: string;
|
|
isCreatedByUser: boolean;
|
|
isLast: boolean;
|
|
isSubmitting: boolean;
|
|
};
|
|
|
|
const ContentParts = memo(
|
|
({ content, messageId, isCreatedByUser, isLast, isSubmitting }: ContentPartsProps) => {
|
|
return (
|
|
<>
|
|
{content
|
|
.filter((part) => part)
|
|
.map((part, idx) => (
|
|
<Part
|
|
key={`display-${messageId}-${idx}`}
|
|
part={part}
|
|
isSubmitting={isSubmitting}
|
|
showCursor={idx === content.length - 1 && isLast}
|
|
messageId={messageId}
|
|
isCreatedByUser={isCreatedByUser}
|
|
/>
|
|
))}
|
|
</>
|
|
);
|
|
},
|
|
);
|
|
|
|
export default ContentParts;
|