6
6
} from "@/components/ui/chat/chat-bubble" ;
7
7
import { ChatInput } from "@/components/ui/chat/chat-input" ;
8
8
import { ChatMessageList } from "@/components/ui/chat/chat-message-list" ;
9
- import { useTransition , animated } from "@react-spring/web" ;
9
+ import { useTransition , animated , AnimatedProps } from "@react-spring/web" ;
10
10
import { Paperclip , Send , X } from "lucide-react" ;
11
11
import { useEffect , useRef , useState } from "react" ;
12
12
import { Content , UUID } from "@elizaos/core" ;
@@ -23,14 +23,18 @@ import { IAttachment } from "@/types";
23
23
import { AudioRecorder } from "./audio-recorder" ;
24
24
import { Badge } from "./ui/badge" ;
25
25
26
- interface ExtraContentFields {
26
+ type ExtraContentFields = {
27
27
user : string ;
28
28
createdAt : number ;
29
29
isLoading ?: boolean ;
30
- }
30
+ } ;
31
31
32
32
type ContentWithUser = Content & ExtraContentFields ;
33
33
34
+ type AnimatedDivProps = AnimatedProps < { style : React . CSSProperties } > & {
35
+ children ?: React . ReactNode ;
36
+ } ;
37
+
34
38
export default function Page ( { agentId } : { agentId : UUID } ) {
35
39
const { toast } = useToast ( ) ;
36
40
const [ selectedFile , setSelectedFile ] = useState < File | null > ( null ) ;
@@ -67,7 +71,6 @@ export default function Page({ agentId }: { agentId: UUID }) {
67
71
}
68
72
} ;
69
73
70
-
71
74
const handleSendMessage = ( e : React . FormEvent < HTMLFormElement > ) => {
72
75
e . preventDefault ( ) ;
73
76
if ( ! input ) return ;
@@ -167,17 +170,23 @@ export default function Page({ agentId }: { agentId: UUID }) {
167
170
leave : { opacity : 0 , transform : "translateY(10px)" } ,
168
171
} ) ;
169
172
173
+ const CustomAnimatedDiv = animated . div as React . FC < AnimatedDivProps > ;
174
+
170
175
return (
171
176
< div className = "flex flex-col w-full h-[calc(100dvh)] p-4" >
172
177
< div className = "flex-1 overflow-y-auto" >
173
178
< ChatMessageList ref = { messagesContainerRef } >
174
179
{ transitions ( ( styles , message ) => {
175
180
const variant = getMessageVariant ( message ?. user ) ;
176
181
return (
177
- // @ts -expect-error
178
- < animated . div
179
- style = { styles }
180
- className = "flex flex-col gap-2 p-4"
182
+ < CustomAnimatedDiv
183
+ style = { {
184
+ ...styles ,
185
+ display : "flex" ,
186
+ flexDirection : "column" ,
187
+ gap : "0.5rem" ,
188
+ padding : "1rem" ,
189
+ } }
181
190
>
182
191
< ChatBubble
183
192
variant = { variant }
@@ -266,7 +275,7 @@ export default function Page({ agentId }: { agentId: UUID }) {
266
275
</ div >
267
276
</ div >
268
277
</ ChatBubble >
269
- </ animated . div >
278
+ </ CustomAnimatedDiv >
270
279
) ;
271
280
} ) }
272
281
</ ChatMessageList >
0 commit comments