diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 87cbbe51..7d3333ee 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -119,6 +119,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { .delete(id, {}) .then(() => { fetchConversations(); + resetConversation(); }) .catch((error) => console.error(error)); }; @@ -155,6 +156,15 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { }); }; + const resetConversation = () => { + dispatch(setConversation([])); + dispatch( + updateConversationId({ + query: { conversationId: null }, + }), + ); + }; + async function updateConversationName(updatedConversation: { name: string; id: string; @@ -235,14 +245,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { { - dispatch(setConversation([])); - dispatch( - updateConversationId({ - query: { conversationId: null }, - }), - ); - }} + onClick={resetConversation} className={({ isActive }) => `${ isActive ? 'bg-gray-3000 dark:bg-transparent' : '' @@ -310,6 +313,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { isActive ? 'bg-gray-3000 dark:bg-transparent' : '' }` } + onClick={resetConversation} > :@/?retryWrites=true&w=majority") - db = client["docsgpt"] + client = pymongo.MongoClient(MONGO_ATLAS_URI) + db = client[DB_NAME] vectors_collection = db["vectors"] - - # mongodb atlas collection documents_collection = db["documents"] - for vector in vectors_collection.find(): - documents_collection.update_many({"store": vector["user"] + "/" + vector["name"]}, {"$set": {"source_id": str(vector["_id"])}}) + # Backup collections before migration + backup_collection(vectors_collection, "vectors_backup") + backup_collection(documents_collection, "documents_backup") + + vectors = list(vectors_collection.find()) + for vector in tqdm(vectors, desc="Updating Mongo Atlas vectors"): + documents_collection.update_many( + {"store": vector["user"] + "/" + vector["name"]}, + {"$set": {"source_id": str(vector["_id"])}} + ) client.close() + logger.info("Mongo Atlas migration completed") -migrate_faiss_to_v1_vectorstore() -migrate_to_v1_vectorstore_mongo() \ No newline at end of file +if __name__ == "__main__": + migrate_faiss_to_v1_vectorstore() + migrate_to_v1_vectorstore_mongo() + migrate_mongo_atlas_vector_to_v1_vectorstore()