File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,9 @@ const useAssistants = (): UseAssistantsValues => {
7979 ] ) . then ( ( ans ) => {
8080 const a = postAppDataAsync ( {
8181 ...DEFAULT_CHATBOT_RESPONSE_APP_DATA ,
82- data : ans ,
82+ data : {
83+ ...ans ,
84+ } ,
8385 } ) as Promise < ChatbotResponseAppData > ;
8486 return a ;
8587 } ) ;
@@ -124,7 +126,7 @@ const useAssistants = (): UseAssistantsValues => {
124126 const a = postAppDataAsync ( {
125127 ...DEFAULT_CHATBOT_RESPONSE_APP_DATA ,
126128 data : {
127- ans,
129+ ... ans , // Be careful. Destructure.
128130 assistantId : assistant . id ,
129131 } ,
130132 } ) as Promise < ChatbotResponseAppData > ;
@@ -164,7 +166,7 @@ const useAssistants = (): UseAssistantsValues => {
164166 ) ;
165167 } )
166168 . map ( ( promise ) =>
167- promise . then ( ( assistantResponseAppData ) => {
169+ promise . then ( async ( assistantResponseAppData ) => {
168170 if ( assistantResponseAppData ) {
169171 const { completion : response , assistantId } =
170172 assistantResponseAppData . data ;
Original file line number Diff line number Diff line change @@ -79,11 +79,13 @@ const useSteps = (): UseStepsValues => {
7979
8080 if ( ( nextStep ?. round || 0 ) > round ) {
8181 // TODO: Insane amount of work here. REFACTOR!
82- await generateResponsesWithEachAssistant ( ) . then ( ( ) =>
83- createAllResponsesSet ( ) . then ( ( ) => {
84- changeStep ( nextStep , nextStepIndex ) ;
85- } ) ,
86- ) ;
82+ await generateResponsesWithEachAssistant ( )
83+ . then ( ( p ) => Promise . all ( p ) )
84+ . then ( ( ) =>
85+ createAllResponsesSet ( ) . then ( ( ) => {
86+ changeStep ( nextStep , nextStepIndex ) ;
87+ } ) ,
88+ ) ;
8789 } else {
8890 changeStep ( nextStep , nextStepIndex ) ;
8991 }
You can’t perform that action at this time.
0 commit comments