mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-23 10:46:12 +01:00
* 🔧 fix: Log warning for aborted operations in AgentClient
* ci: Remove unused saveMessageToDatabase mock in FakeClient initialization
* ci: test actual implementation of saveMessageToDatabase
* refactor: Change log level from warning to error for aborted operations in AgentClient
* refactor: Add className prop to Image component for customizable styling, use theme selectors
* feat: FLUX Image Generation tool
25 lines
758 B
TypeScript
25 lines
758 B
TypeScript
import { imageExtRegex } from 'librechat-data-provider';
|
|
import type { TAttachment, TFile, TAttachmentMetadata } from 'librechat-data-provider';
|
|
import Image from '~/components/Chat/Messages/Content/Image';
|
|
|
|
export default function Attachment({ attachment }: { attachment?: TAttachment }) {
|
|
if (!attachment) {
|
|
return null;
|
|
}
|
|
const { width, height, filepath = null } = attachment as TFile & TAttachmentMetadata;
|
|
const isImage =
|
|
imageExtRegex.test(attachment.filename) && width != null && height != null && filepath != null;
|
|
|
|
if (isImage) {
|
|
return (
|
|
<Image
|
|
altText={attachment.filename}
|
|
imagePath={filepath}
|
|
height={height}
|
|
width={width}
|
|
className="mb-4"
|
|
/>
|
|
);
|
|
}
|
|
return null;
|
|
}
|