@@ -815,8 +815,8 @@ class ChatStore {
815815 this . activeMessages = this . activeMessages . slice ( 0 , messageIndex + 1 ) ;
816816 this . updateConversationTimestamp ( ) ;
817817
818- this . isLoading = true ;
819- this . currentResponse = '' ;
818+ this . setConversationLoading ( this . activeConversation . id , true ) ;
819+ this . clearConversationStreaming ( this . activeConversation . id ) ;
820820
821821 try {
822822 const assistantMessage = await this . createAssistantMessage ( ) ;
@@ -839,7 +839,7 @@ class ChatStore {
839839 ) ;
840840 } catch ( regenerateError ) {
841841 console . error ( 'Failed to regenerate response:' , regenerateError ) ;
842- this . isLoading = false ;
842+ this . setConversationLoading ( this . activeConversation ! . id , false ) ;
843843
844844 const messageIndex = this . findMessageIndex ( messageId ) ;
845845 this . updateMessageAtIndex ( messageIndex , { content : originalContent } ) ;
@@ -881,8 +881,8 @@ class ChatStore {
881881 this . activeMessages = this . activeMessages . slice ( 0 , messageIndex ) ;
882882 this . updateConversationTimestamp ( ) ;
883883
884- this . isLoading = true ;
885- this . currentResponse = '' ;
884+ this . setConversationLoading ( this . activeConversation . id , true ) ;
885+ this . clearConversationStreaming ( this . activeConversation . id ) ;
886886
887887 try {
888888 const parentMessageId =
@@ -903,7 +903,7 @@ class ChatStore {
903903 await this . streamChatCompletion ( conversationContext , assistantMessage ) ;
904904 } catch ( regenerateError ) {
905905 console . error ( 'Failed to regenerate response:' , regenerateError ) ;
906- this . isLoading = false ;
906+ this . setConversationLoading ( this . activeConversation ! . id , false ) ;
907907 }
908908 } catch ( error ) {
909909 if ( this . isAbortError ( error ) ) return ;
@@ -1517,8 +1517,8 @@ class ChatStore {
15171517 return ;
15181518 }
15191519
1520- this . isLoading = true ;
1521- this . currentResponse = '' ;
1520+ this . setConversationLoading ( this . activeConversation . id , true ) ;
1521+ this . clearConversationStreaming ( this . activeConversation . id ) ;
15221522
15231523 const newAssistantMessage = await DatabaseStore . createMessageBranch (
15241524 {
@@ -1552,7 +1552,7 @@ class ChatStore {
15521552 if ( this . isAbortError ( error ) ) return ;
15531553
15541554 console . error ( 'Failed to regenerate message with branching:' , error ) ;
1555- this . isLoading = false ;
1555+ this . setConversationLoading ( this . activeConversation ! . id , false ) ;
15561556 }
15571557 }
15581558
@@ -1564,8 +1564,8 @@ class ChatStore {
15641564 if ( ! this . activeConversation ) return ;
15651565
15661566 this . errorDialogState = null ;
1567- this . isLoading = true ;
1568- this . currentResponse = '' ;
1567+ this . setConversationLoading ( this . activeConversation . id , true ) ;
1568+ this . clearConversationStreaming ( this . activeConversation . id ) ;
15691569
15701570 try {
15711571 // Get conversation path up to the user message
@@ -1597,7 +1597,7 @@ class ChatStore {
15971597 await this . streamChatCompletion ( conversationPath , assistantMessage ) ;
15981598 } catch ( error ) {
15991599 console . error ( 'Failed to generate response:' , error ) ;
1600- this . isLoading = false ;
1600+ this . setConversationLoading ( this . activeConversation ! . id , false ) ;
16011601 }
16021602 }
16031603
0 commit comments