@@ -159,17 +159,40 @@ class ActionProvider {
159159 }
160160 } ;
161161
162- handleResetContext = ( ) => {
162+ handleResetContext = ( accessToken ) => {
163163 localStorage . removeItem ( "chat_messages" ) ;
164164 this . clearMessages ( ) ;
165- const message = this . createChatBotMessage (
166- "Chat context has been cleared." ,
167- {
168- loading : true ,
169- terminateLoading : true ,
170- } ,
171- ) ;
172- this . addMessageToState ( message ) ;
165+ const resetUrl = APIService . CHATBOT_SERVICE + "genai/reset" ;
166+ superagent
167+ . post ( resetUrl )
168+ . set ( "Accept" , "application/json" )
169+ . set ( "Content-Type" , "application/json" )
170+ . set ( "Authorization" , `Bearer ${ accessToken } ` )
171+ . end ( ( err , res ) => {
172+ if ( err ) {
173+ console . log ( err ) ;
174+ const errormessage = this . createChatBotMessage (
175+ "Failed to clear chat context." ,
176+ {
177+ loading : true ,
178+ terminateLoading : true ,
179+ } ,
180+ ) ;
181+ this . addMessageToState ( errormessage ) ;
182+ return ;
183+ }
184+ console . log ( res ) ;
185+ const successmessage = this . createChatBotMessage (
186+ "Chat context has been cleared." ,
187+ {
188+ loading : true ,
189+ terminateLoading : true ,
190+ } ,
191+ ) ;
192+ this . addMessageToState ( successmessage ) ;
193+ this . addInitializedToState ( ) ;
194+ } ) ;
195+ return ;
173196 } ;
174197
175198 addMessageToState = ( message ) => {
0 commit comments