chat ui fix size

This commit is contained in:
Ishaan Jaff 2025-04-11 18:40:58 -07:00
parent f3237c615e
commit f314e08ab4

View file

@ -455,7 +455,13 @@ const ChatUI: React.FC<ChatUIProps> = ({
{message.reasoningContent && ( {message.reasoningContent && (
<ReasoningContent reasoningContent={message.reasoningContent} /> <ReasoningContent reasoningContent={message.reasoningContent} />
)} )}
<div className="whitespace-pre-wrap break-words max-w-full message-content"> <div className="whitespace-pre-wrap break-words max-w-full message-content"
style={{
wordWrap: 'break-word',
overflowWrap: 'break-word',
wordBreak: 'break-word',
hyphens: 'auto'
}}>
{message.isImage ? ( {message.isImage ? (
<img <img
src={message.content} src={message.content}
@ -477,16 +483,21 @@ const ChatUI: React.FC<ChatUIProps> = ({
language={match[1]} language={match[1]}
PreTag="div" PreTag="div"
className="rounded-md my-2" className="rounded-md my-2"
wrapLines={true}
wrapLongLines={true}
{...props} {...props}
> >
{String(children).replace(/\n$/, '')} {String(children).replace(/\n$/, '')}
</SyntaxHighlighter> </SyntaxHighlighter>
) : ( ) : (
<code className={`${className} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`} {...props}> <code className={`${className} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`} style={{ wordBreak: 'break-word' }} {...props}>
{children} {children}
</code> </code>
); );
} },
pre: ({ node, ...props }) => (
<pre style={{ overflowX: 'auto', maxWidth: '100%' }} {...props} />
)
}} }}
> >
{message.content} {message.content}