feat: enhance MessageBubble with custom Markdown rendering, update Navbar layout, and integrate Search component in App

This commit is contained in:
ecwu
2025-01-26 21:15:34 +00:00
parent 233397ba46
commit 55e8186479
5 changed files with 75 additions and 102 deletions

View File

@@ -322,7 +322,35 @@ export default function Message(props: { messageIndex: number }) {
) : chat.role === "tool" ? (
<MessageToolResp chat={chat} copyToClipboard={copyToClipboard} />
) : renderMarkdown ? (
<Markdown>{getMessageText(chat)}</Markdown>
<div className="message-content max-w-full md:max-w-[75%]">
<Markdown
break={true}
components={{
code: ({ children }) => (
<code className="bg-muted px-1 py-0.5 rounded">
{children}
</code>
),
pre: ({ children }) => (
<pre className="bg-muted p-4 rounded-lg overflow-auto">
{children}
</pre>
),
a: ({ href, children }) => (
<a
href={href}
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline"
>
{children}
</a>
),
}}
>
{getMessageText(chat)}
</Markdown>
</div>
) : (
<div className="message-content max-w-full md:max-w-[75%]">
{chat.content &&