mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-15 08:21:16 +03:00
Render attachment chip in user chat bubbles
This commit is contained in:
parent
2b538ae54b
commit
cddbf6906a
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user