@@ -24,6 +24,7 @@ import type {
2424 ActiveImages ,
2525 ChatPayload ,
2626 CommandPayload ,
27+ ExtraChatPayload ,
2728 FileInfo ,
2829 RequestStore ,
2930 UploadOptions ,
@@ -195,6 +196,13 @@ function LegacyChatPanelComponent(
195196 errors
196197 ) ;
197198
199+ const humanInput = useCallback (
200+ ( input : string | null , action ?: string , extra ?: ExtraChatPayload ) => {
201+ humanInputRef . current ?.( input , action , extra ) ;
202+ } ,
203+ [ humanInputRef ]
204+ ) ;
205+
198206 const [ depsReady , setDepsReady ] = useState ( false ) ;
199207 useEffect ( ( ) => {
200208 let ignore = false ;
@@ -225,11 +233,9 @@ function LegacyChatPanelComponent(
225233 async ( payload : ChatPayload ) => {
226234 if ( conversationId ) {
227235 const { content, ...extra } = payload ;
228- humanInputRef . current ?.( content , undefined , {
229- ...extra ,
230- ...( aiEmployeeId ? { aiEmployeeId } : null ) ,
231- ...( cmd ? { cmd } : null ) ,
232- } ) ;
236+ // For follow-up messages, do not pass aiEmployeeId and cmd again,
237+ // unless passed explicitly.
238+ humanInput ( content , undefined , extra ) ;
233239 return ;
234240 }
235241 setSubmitDisabled ( true ) ;
@@ -254,7 +260,7 @@ function LegacyChatPanelComponent(
254260 setSubmitDisabled ( false ) ;
255261 }
256262 } ,
257- [ aiEmployeeId , cmd , conversationId , humanInputRef ]
263+ [ aiEmployeeId , cmd , conversationId , humanInput ]
258264 ) ;
259265
260266 const [ activeFile , setActiveFile ] = useState < FileInfo | null > ( null ) ;
@@ -265,8 +271,9 @@ function LegacyChatPanelComponent(
265271 ( {
266272 setActiveFile,
267273 setActiveImages,
274+ humanInput,
268275 } ) as TaskContextValue ,
269- [ ]
276+ [ humanInput ]
270277 ) ;
271278
272279 useImperativeHandle (
0 commit comments