From 86c2f0716ea16ccc5c8d7179060147cf70859ae5 Mon Sep 17 00:00:00 2001 From: Adarsh Jha <132337675+adarsh-jha-dev@users.noreply.github.com> Date: Fri, 6 Oct 2023 19:36:48 +0530 Subject: [PATCH] Update conversationSlice.ts --- frontend/src/conversation/conversationSlice.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/src/conversation/conversationSlice.ts b/frontend/src/conversation/conversationSlice.ts index d1d4e19df..ffe402b0d 100644 --- a/frontend/src/conversation/conversationSlice.ts +++ b/frontend/src/conversation/conversationSlice.ts @@ -142,14 +142,14 @@ export const conversationSlice = createSlice({ state, action: PayloadAction<{ index: number; query: Partial }>, ) { - const index = action.payload.index; - if (action.payload.query.response) { + const { index, query } = action.payload; + if (query.response) { state.queries[index].response = - (state.queries[index].response || '') + action.payload.query.response; + (state.queries[index].response || '') + query.response; } else { state.queries[index] = { ...state.queries[index], - ...action.payload.query, + ...query, }; } }, @@ -163,21 +163,21 @@ export const conversationSlice = createSlice({ state, action: PayloadAction<{ index: number; query: Partial }>, ) { - const index = action.payload.index; + const { index, query } = action.payload; if (!state.queries[index].sources) { - state.queries[index].sources = [action.payload.query.sources![0]]; + state.queries[index].sources = [query.sources![0]]; } else { - state.queries[index].sources!.push(action.payload.query.sources![0]); + state.queries[index].sources!.push(query.sources![0]); } }, updateQuery( state, action: PayloadAction<{ index: number; query: Partial }>, ) { - const index = action.payload.index; + const { index, query } = action.payload; state.queries[index] = { ...state.queries[index], - ...action.payload.query, + ...query, }; }, setStatus(state, action: PayloadAction) {