Render attachment chip in user chat bubbles

This commit is contained in:
Josh Hawkins 2026-04-08 17:00:35 -05:00
parent 2b538ae54b
commit cddbf6906a

View File

@ -15,6 +15,8 @@ import {
TooltipTrigger, TooltipTrigger,
} from "@/components/ui/tooltip"; } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { ChatAttachmentChip } from "@/components/chat/ChatAttachmentChip";
import { parseAttachedEvent } from "@/utils/chatUtil";
type MessageBubbleProps = { type MessageBubbleProps = {
role: "user" | "assistant"; role: "user" | "assistant";
@ -126,6 +128,10 @@ export function MessageBubble({
); );
} }
const { eventId: attachedEventId, body: displayContent } = isUser
? parseAttachedEvent(content)
: { eventId: null, body: content };
return ( return (
<div <div
className={cn( className={cn(
@ -140,7 +146,12 @@ export function MessageBubble({
)} )}
> >
{isUser ? ( {isUser ? (
content <div className="flex flex-col gap-2">
{attachedEventId && (
<ChatAttachmentChip eventId={attachedEventId} mode="bubble" />
)}
<div className="whitespace-pre-wrap">{displayContent}</div>
</div>
) : ( ) : (
<> <>
<ReactMarkdown <ReactMarkdown