add property sync and etc ... to align with original source

This commit is contained in:
fadingNA
2024-11-10 15:33:19 -05:00
parent 6c585de6d3
commit 32c67c2a02

View File

@@ -465,10 +465,17 @@ class PaginatedSources(Resource):
paginated_docs = [] paginated_docs = []
for doc in documents: for doc in documents:
print(doc) doc_data = {
doc["id"] = str(doc["_id"]) "id": str(doc["_id"]),
del doc["_id"] "name": doc.get("name", ""),
paginated_docs.append(doc) "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 = { response = {
"total": total_documents, "total": total_documents,
@@ -499,9 +506,7 @@ class CombinedJson(Resource):
] ]
try: try:
for index in sources_collection.find({"user": user}).sort( for index in sources_collection.find({"user": user}).sort("date", -1):
"date", -1
):
data.append( data.append(
{ {
"id": str(index["_id"]), "id": str(index["_id"]),