import { Markdown } from './Markdown'; import { modificationsRegex } from '~/utils/diff'; interface MessageContent { type: string; text?: string; image?: string; } interface UserMessageProps { content: string | MessageContent[]; } export function UserMessage({ content }: UserMessageProps) { return (
{Array.isArray(content) ? (
{content.map((item, index) => { if (item.type === 'text') { return ( {sanitizeUserMessage(item.text || '')} ); } else if (item.type === 'image') { return (
User uploaded
); } return null; })}
) : ( {sanitizeUserMessage(content)} )}
); } function sanitizeUserMessage(content: string) { return content.replace(modificationsRegex, '').trim(); }