11'use client' ;
22
3- import type { ComponentProps , HTMLAttributes , ReactElement } from 'react' ;
4- import { createContext , memo , useContext , useEffect , useState } from 'react' ;
5- import type { FileUIPart , UIMessage } from 'ai' ;
6- import { ChevronLeftIcon , ChevronRightIcon , PaperclipIcon , XIcon } from 'lucide-react' ;
7- import { Streamdown } from 'streamdown' ;
83import { Button } from '@/components/ui/button' ;
94import { ButtonGroup , ButtonGroupText } from '@/components/ui/button-group' ;
105import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from '@/components/ui/tooltip' ;
116import { cn } from '@/lib/utils' ;
7+ import type { FileUIPart , UIMessage } from 'ai' ;
8+ import { ChevronLeftIcon , ChevronRightIcon , PaperclipIcon , XIcon } from 'lucide-react' ;
9+ import type { ComponentProps , HTMLAttributes , ReactElement } from 'react' ;
10+ import { createContext , memo , useContext , useEffect , useState } from 'react' ;
11+ import { Streamdown } from 'streamdown' ;
1212
1313export type MessageProps = HTMLAttributes < HTMLDivElement > & {
1414 from : UIMessage [ 'role' ] ;
@@ -17,9 +17,9 @@ export type MessageProps = HTMLAttributes<HTMLDivElement> & {
1717export const Message = ( { className, from, ...props } : MessageProps ) => (
1818 < div
1919 className = { cn (
20- 'group flex w-full max-w-[80 %] flex-col gap-2' ,
20+ 'group flex w-full max-w-[95 %] flex-col gap-2' ,
2121 from === 'user' ? 'is-user ml-auto justify-end' : 'is-assistant' ,
22- className
22+ className ,
2323 ) }
2424 { ...props }
2525 />
@@ -30,10 +30,10 @@ export type MessageContentProps = HTMLAttributes<HTMLDivElement>;
3030export const MessageContent = ( { children, className, ...props } : MessageContentProps ) => (
3131 < div
3232 className = { cn (
33- 'is-user:dark flex w-fit flex-col gap-2 overflow-hidden text-sm' ,
34- 'group-[.is-user]:bg-secondary group-[.is-user]:text-foreground group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:px-4 group-[.is-user]:py-3 ' ,
33+ 'is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm' ,
34+ 'group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground ' ,
3535 'group-[.is-assistant]:text-foreground' ,
36- className
36+ className ,
3737 ) }
3838 { ...props }
3939 >
@@ -168,7 +168,7 @@ export const MessageBranchContent = ({ children, ...props }: MessageBranchConten
168168 < div
169169 className = { cn (
170170 'grid gap-2 overflow-hidden [&>div]:pb-0' ,
171- index === currentBranch ? 'block' : 'hidden'
171+ index === currentBranch ? 'block' : 'hidden' ,
172172 ) }
173173 key = { branch . key }
174174 { ...props }
@@ -250,7 +250,7 @@ export const MessageBranchPage = ({ className, ...props }: MessageBranchPageProp
250250
251251 return (
252252 < ButtonGroupText
253- className = { cn ( 'text-muted-foreground border-none bg-transparent shadow-none' , className ) }
253+ className = { cn ( 'border-none bg-transparent text-muted-foreground shadow-none' , className ) }
254254 { ...props }
255255 >
256256 { currentBranch + 1 } of { totalBranches }
@@ -267,7 +267,7 @@ export const MessageResponse = memo(
267267 { ...props }
268268 />
269269 ) ,
270- ( prevProps , nextProps ) => prevProps . children === nextProps . children
270+ ( prevProps , nextProps ) => prevProps . children === nextProps . children ,
271271) ;
272272
273273MessageResponse . displayName = 'MessageResponse' ;
@@ -298,7 +298,7 @@ export function MessageAttachment({ data, className, onRemove, ...props }: Messa
298298 { onRemove && (
299299 < Button
300300 aria-label = "Remove attachment"
301- className = "bg-background/80 hover:bg-background absolute top-2 right-2 size-6 rounded-full p-0 opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100 [&>svg]:size-3"
301+ className = "absolute top-2 right-2 size-6 rounded-full bg-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-background group-hover:opacity-100 [&>svg]:size-3"
302302 onClick = { ( e ) => {
303303 e . stopPropagation ( ) ;
304304 onRemove ( ) ;
@@ -315,7 +315,7 @@ export function MessageAttachment({ data, className, onRemove, ...props }: Messa
315315 < >
316316 < Tooltip >
317317 < TooltipTrigger asChild >
318- < div className = "bg-muted text-muted-foreground flex size-full shrink-0 items-center justify-center rounded-lg" >
318+ < div className = "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground " >
319319 < PaperclipIcon className = "size-4" />
320320 </ div >
321321 </ TooltipTrigger >
@@ -326,7 +326,7 @@ export function MessageAttachment({ data, className, onRemove, ...props }: Messa
326326 { onRemove && (
327327 < Button
328328 aria-label = "Remove attachment"
329- className = "hover:bg-accent size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity group-hover:opacity-100 [&>svg]:size-3"
329+ className = "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3"
330330 onClick = { ( e ) => {
331331 e . stopPropagation ( ) ;
332332 onRemove ( ) ;
0 commit comments