From 32c67c2a0213a829a02f366084c41024f7e45cd9 Mon Sep 17 00:00:00 2001 From: fadingNA Date: Sun, 10 Nov 2024 15:33:19 -0500 Subject: [PATCH] add property sync and etc ... to align with original source --- application/api/user/routes.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/application/api/user/routes.py b/application/api/user/routes.py index 46ed15cd..37a3f7a1 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -465,10 +465,17 @@ class PaginatedSources(Resource): paginated_docs = [] for doc in documents: - print(doc) - doc["id"] = str(doc["_id"]) - del doc["_id"] - paginated_docs.append(doc) + doc_data = { + "id": str(doc["_id"]), + "name": doc.get("name", ""), + "date": doc.get("date", ""), + "model": settings.EMBEDDINGS_NAME, + "location": "local", + "tokens": doc.get("tokens", ""), + "retriever": doc.get("retriever", "classic"), + "syncFrequency": doc.get("sync_frequency", ""), + } + paginated_docs.append(doc_data) response = { "total": total_documents, @@ -499,9 +506,7 @@ class CombinedJson(Resource): ] try: - for index in sources_collection.find({"user": user}).sort( - "date", -1 - ): + for index in sources_collection.find({"user": user}).sort("date", -1): data.append( { "id": str(index["_id"]),