@@ -44,6 +44,8 @@ import { WrappedChatInput, WrappedIcon } from "../shared/bricks";
4444import { FilePreview } from "../shared/FilePreview/FilePreview.js" ;
4545import { ImagesPreview } from "../shared/FilePreview/ImagesPreview.js" ;
4646import { TaskContext , type TaskContextValue } from "../shared/TaskContext" ;
47+ import type { UseBrickConf } from "@next-core/types" ;
48+ import { ReactUseMultipleBricks } from "@next-core/react-runtime" ;
4749
4850const WrappedModal = wrapBrick <
4951 Modal ,
@@ -74,6 +76,7 @@ export interface ChatPanelProps {
7476 height ?: string | number ;
7577 placeholder ?: string ;
7678 uploadOptions ?: UploadOptions ;
79+ help ?: { useBrick : UseBrickConf } ;
7780}
7881
7982const ChatPanelComponent = forwardRef ( LegacyChatPanelComponent ) ;
@@ -105,6 +108,12 @@ class ChatPanel extends ReactNextElement implements ChatPanelProps {
105108 @property ( { attribute : false } )
106109 accessor uploadOptions : UploadOptions | undefined ;
107110
111+ /**
112+ * Show help messages when no conversation exists.
113+ */
114+ @property ( { attribute : false } )
115+ accessor help : { useBrick : UseBrickConf } | undefined ;
116+
108117 #ref = createRef < ChatPanelRef > ( ) ;
109118
110119 @method ( )
@@ -117,6 +126,11 @@ class ChatPanel extends ReactNextElement implements ChatPanelProps {
117126 this . #ref. current ?. close ( ) ;
118127 }
119128
129+ @method ( )
130+ setInputValue ( content : string ) {
131+ this . #ref. current ?. setInputValue ( content ) ;
132+ }
133+
120134 @method ( )
121135 send ( payload : ChatPayload ) {
122136 this . #ref. current ?. send ( payload ) ;
@@ -138,6 +152,7 @@ class ChatPanel extends ReactNextElement implements ChatPanelProps {
138152 height = { this . height }
139153 placeholder = { this . placeholder }
140154 uploadOptions = { this . uploadOptions }
155+ help = { this . help }
141156 />
142157 ) ;
143158 }
@@ -151,6 +166,7 @@ interface ChatPanelComponentProps extends ChatPanelProps {
151166interface ChatPanelRef {
152167 open : ( ) => void ;
153168 close : ( ) => void ;
169+ setInputValue : ( content : string ) => void ;
154170 send : ( payload : ChatPayload ) => void ;
155171 showFile : ( file : FileInfo ) => void ;
156172}
@@ -164,6 +180,7 @@ function LegacyChatPanelComponent(
164180 height,
165181 placeholder,
166182 uploadOptions,
183+ help,
167184 } : ChatPanelComponentProps ,
168185 ref : React . Ref < ChatPanelRef >
169186) {
@@ -286,6 +303,9 @@ function LegacyChatPanelComponent(
286303 close : ( ) => {
287304 modalRef . current ?. close ( ) ;
288305 } ,
306+ setInputValue : ( content : string ) => {
307+ inputRef . current ?. setValue ( content ) ;
308+ } ,
289309 send : ( payload : ChatPayload ) => {
290310 handleChatSubmit ( payload ) ;
291311 } ,
@@ -317,7 +337,11 @@ function LegacyChatPanelComponent(
317337 >
318338 < div className = { styles . panel } >
319339 { ! conversationId ? (
320- < div className = { styles . main } />
340+ < div className = { styles . main } >
341+ { help ? (
342+ < ReactUseMultipleBricks useBrick = { help . useBrick } />
343+ ) : null }
344+ </ div >
321345 ) : conversationAvailable && depsReady ? (
322346 < div className = { styles . main } >
323347 < div className = { styles . chat } ref = { scrollContainerRef } >
0 commit comments