File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
bricks/ai-portal/src/cruise-canvas Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ export const conversation: Reducer<
2626 case "reset" :
2727 return null ;
2828
29+ case "started" :
30+ if ( state ) {
31+ return { ...state , finished : false } ;
32+ }
33+ return state ;
34+
2935 case "finished" :
3036 if ( state ) {
3137 return { ...state , finished : true } ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export interface CruiseCanvasState {
1616export type CruiseCanvasAction =
1717 | ConversationSSEAction
1818 | ConversationResetAction
19+ | ConversationStartedAction
1920 | ConversationFinishedAction ;
2021
2122export interface ConversationSSEAction {
@@ -28,6 +29,10 @@ export interface ConversationResetAction {
2829 type : "reset" ;
2930}
3031
32+ export interface ConversationStartedAction {
33+ type : "started" ;
34+ }
35+
3136export interface ConversationFinishedAction {
3237 type : "finished" ;
3338}
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ export function useConversationDetail(
104104
105105 requesting = true ;
106106 ctrl = new AbortController ( ) ;
107+ dispatch ( { type : "started" } ) ;
107108 try {
108109 const sseRequest = await ( content === null && ! action
109110 ? createSSEStream < ConversationPatch > (
@@ -157,13 +158,13 @@ export function useConversationDetail(
157158 dispatch ( { type : "sse" , payload : value , workspace : conversationId } ) ;
158159 isInitial = false ;
159160 }
160- dispatch ( { type : "finished" } ) ;
161161 } catch ( e ) {
162162 // eslint-disable-next-line no-console
163163 console . error ( "sse failed" , e ) ;
164164 handleHttpError ( e ) ;
165165 } finally {
166166 requesting = false ;
167+ dispatch ( { type : "finished" } ) ;
167168 }
168169 } ;
169170
You can’t perform that action at this time.
0 commit comments