mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 18:00:15 +01:00
* fix(useContentHandler): retain undefined parts and handle them within `ContentParts` rendering * fix(AssistantService/in_progress): skip empty messages * refactor(RunManager): create highly specific `seenSteps` Set keys for RunSteps with use of `getDetailsSignature` and `getToolCallSignature`,to ensure changes from polling are always captured
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import { Suspense } from 'react';
|
|
import type { TMessageContentParts } from 'librechat-data-provider';
|
|
import { UnfinishedMessage } from './MessageContent';
|
|
import { DelayedRender } from '~/components/ui';
|
|
import Part from './Part';
|
|
|
|
const ContentParts = ({
|
|
error,
|
|
unfinished,
|
|
isSubmitting,
|
|
isLast,
|
|
content,
|
|
...props
|
|
}: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
any) => {
|
|
if (error) {
|
|
// return <ErrorMessage text={text} />;
|
|
} else {
|
|
const { message } = props;
|
|
const { messageId } = message;
|
|
|
|
return (
|
|
<>
|
|
{content.map((part: TMessageContentParts | undefined, idx: number) => {
|
|
if (!part) {
|
|
return null;
|
|
}
|
|
return (
|
|
<Part
|
|
key={`display-${messageId}-${idx}`}
|
|
showCursor={idx === content.length - 1 && isLast}
|
|
isSubmitting={isSubmitting}
|
|
part={part}
|
|
{...props}
|
|
/>
|
|
);
|
|
})}
|
|
{!isSubmitting && unfinished && (
|
|
<Suspense>
|
|
<DelayedRender delay={250}>
|
|
<UnfinishedMessage key={`unfinished-${messageId}`} />
|
|
</DelayedRender>
|
|
</Suspense>
|
|
)}
|
|
</>
|
|
);
|
|
}
|
|
};
|
|
|
|
export default ContentParts;
|