diff --git a/application/api/answer/routes.py b/application/api/answer/routes.py index a413194b..bccffb66 100644 --- a/application/api/answer/routes.py +++ b/application/api/answer/routes.py @@ -130,6 +130,18 @@ def save_conversation(conversation_id, question, response, source_log_docs, llm, } } ) + ##remove following queries from the array + conversations_collection.update_one( + {"_id": ObjectId(conversation_id), f"queries.{index}": {"$exists": True}}, + { + "$push":{ + "queries":{ + "$each":[], + "$slice":index+1 + } + } + } + ) elif conversation_id is not None and conversation_id != "None": conversations_collection.update_one( {"_id": ObjectId(conversation_id)}, diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index 1eee41e7..324c722b 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -337,9 +337,7 @@ const ConversationBubble = forwardRef< ) : ( - - {children} - + {children} ); }, ul({ children }) { diff --git a/frontend/src/conversation/conversationSlice.ts b/frontend/src/conversation/conversationSlice.ts index 9298e7a5..69f81e21 100644 --- a/frontend/src/conversation/conversationSlice.ts +++ b/frontend/src/conversation/conversationSlice.ts @@ -173,7 +173,10 @@ export const conversationSlice = createSlice({ state, action: PayloadAction<{ index: number; prompt: string; query?: Query }>, ) { - state.queries[action.payload.index] = action.payload; + state.queries = [ + ...state.queries.splice(0, action.payload.index), + action.payload, + ]; }, updateStreamingQuery( state, diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index cea14f0a..bbad4763 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -85,7 +85,7 @@ const Documents: React.FC = ({ setSortField(newSortField); setSortOrder(newSortOrder); } - + setLoading(true); getDocsWithPagination( newSortField, newSortOrder,