11import { ScrollShadow } from "@/components/ui/ScrollShadow/ScrollShadow" ;
22import { cn } from "@/lib/utils" ;
33import { MarkdownRenderer } from "components/contract-components/published-contract/markdown-renderer" ;
4- import { AlertCircleIcon , ThumbsDownIcon , ThumbsUpIcon } from "lucide-react" ;
4+ import {
5+ AlertCircleIcon ,
6+ MessageCircleIcon ,
7+ ThumbsDownIcon ,
8+ ThumbsUpIcon ,
9+ } from "lucide-react" ;
510import { useEffect , useRef , useState } from "react" ;
611import type { ThirdwebClient } from "thirdweb" ;
7- import type {
8- NebulaUserMessage ,
9- NebulaUserMessageContent ,
10- } from "../../api/types" ;
11- import { NebulaIcon } from "../../icons/NebulaIcon" ;
1212import { Reasoning } from "../Reasoning/Reasoning" ;
1313
14- export type CustomChatMessage =
15- | {
16- type : "user" ;
17- content : NebulaUserMessageContent ;
18- }
14+ // Define local types
15+ type UserMessageContent = { type : "text" ; text : string } ;
16+ type UserMessage = {
17+ type : "user" ;
18+ content : UserMessageContent [ ] ;
19+ } ;
20+
21+ type CustomChatMessage =
22+ | UserMessage
1923 | {
2024 text : string ;
2125 type : "error" ;
@@ -25,11 +29,10 @@ export type CustomChatMessage =
2529 type : "presence" ;
2630 }
2731 | {
28- // assistant type message loaded from history doesn't have request_id
2932 request_id : string | undefined ;
3033 text : string ;
3134 type : "assistant" ;
32- feedback ?: 1 | - 1 ; // Add feedback tracking for custom chat
35+ feedback ?: 1 | - 1 ;
3336 } ;
3437
3538export function CustomChats ( props : {
@@ -42,7 +45,7 @@ export function CustomChats(props: {
4245 setEnableAutoScroll : ( enable : boolean ) => void ;
4346 enableAutoScroll : boolean ;
4447 useSmallText ?: boolean ;
45- sendMessage : ( message : NebulaUserMessage ) => void ;
48+ sendMessage : ( message : UserMessage ) => void ;
4649 onFeedback ?: ( messageIndex : number , feedback : 1 | - 1 ) => void ;
4750} ) {
4851 const { messages, setEnableAutoScroll, enableAutoScroll } = props ;
@@ -100,14 +103,6 @@ export function CustomChats(props: {
100103 const isMessagePending =
101104 props . isChatStreaming && index === props . messages . length - 1 ;
102105
103- const shouldHideMessage =
104- message . type === "user" &&
105- message . content . every ( ( msg ) => msg . type === "transaction" ) ;
106-
107- if ( shouldHideMessage ) {
108- return null ;
109- }
110-
111106 return (
112107 < div
113108 className = { cn (
@@ -144,7 +139,7 @@ function RenderMessage(props: {
144139 messageIndex : number ;
145140 isMessagePending : boolean ;
146141 client : ThirdwebClient ;
147- sendMessage : ( message : NebulaUserMessage ) => void ;
142+ sendMessage : ( message : UserMessage ) => void ;
148143 nextMessage : CustomChatMessage | undefined ;
149144 authToken : string ;
150145 sessionId : string | undefined ;
@@ -189,12 +184,8 @@ function RenderMessage(props: {
189184 message . type === "presence" && "border bg-card" ,
190185 ) }
191186 >
192- { message . type === "presence" && (
193- < NebulaIcon className = "size-5 text-muted-foreground" />
194- ) }
195-
196- { message . type === "assistant" && (
197- < NebulaIcon className = "size-5 text-muted-foreground" />
187+ { ( message . type === "presence" || message . type === "assistant" ) && (
188+ < MessageCircleIcon className = "size-5 text-muted-foreground" />
198189 ) }
199190
200191 { message . type === "error" && (
@@ -287,7 +278,7 @@ function RenderResponse(props: {
287278 message : CustomChatMessage ;
288279 isMessagePending : boolean ;
289280 client : ThirdwebClient ;
290- sendMessage : ( message : NebulaUserMessage ) => void ;
281+ sendMessage : ( message : UserMessage ) => void ;
291282 nextMessage : CustomChatMessage | undefined ;
292283 sessionId : string | undefined ;
293284 authToken : string ;
0 commit comments