TalatMasood commited on
Commit
37a7e05
·
1 Parent(s): acdfaa9

Sorted the documents list in descending order

Browse files
config/__pycache__/config.cpython-312.pyc CHANGED
Binary files a/config/__pycache__/config.cpython-312.pyc and b/config/__pycache__/config.cpython-312.pyc differ
 
src/__pycache__/main.cpython-312.pyc CHANGED
Binary files a/src/__pycache__/main.cpython-312.pyc and b/src/__pycache__/main.cpython-312.pyc differ
 
src/agents/__pycache__/rag_agent.cpython-312.pyc CHANGED
Binary files a/src/agents/__pycache__/rag_agent.cpython-312.pyc and b/src/agents/__pycache__/rag_agent.cpython-312.pyc differ
 
src/db/__pycache__/mongodb_store.cpython-312.pyc CHANGED
Binary files a/src/db/__pycache__/mongodb_store.cpython-312.pyc and b/src/db/__pycache__/mongodb_store.cpython-312.pyc differ
 
src/implementations/__pycache__/document_service.cpython-312.pyc CHANGED
Binary files a/src/implementations/__pycache__/document_service.cpython-312.pyc and b/src/implementations/__pycache__/document_service.cpython-312.pyc differ
 
src/main.py CHANGED
@@ -131,6 +131,11 @@ async def get_all_documents():
131
  logger.error(
132
  f"Error formatting document {doc.get('document_id', 'unknown')}: {str(e)}")
133
  continue
 
 
 
 
 
134
 
135
  return {
136
  "total_documents": len(formatted_documents),
 
131
  logger.error(
132
  f"Error formatting document {doc.get('document_id', 'unknown')}: {str(e)}")
133
  continue
134
+ # Sort documents by upload_timestamp in descending order (latest first)
135
+ formatted_documents.sort(
136
+ key=lambda x: x.get("upload_timestamp", datetime.min),
137
+ reverse=True
138
+ )
139
 
140
  return {
141
  "total_documents": len(formatted_documents),
src/utils/__pycache__/document_processor.cpython-312.pyc CHANGED
Binary files a/src/utils/__pycache__/document_processor.cpython-312.pyc and b/src/utils/__pycache__/document_processor.cpython-312.pyc differ
 
src/utils/__pycache__/drive_document_processor.cpython-312.pyc CHANGED
Binary files a/src/utils/__pycache__/drive_document_processor.cpython-312.pyc and b/src/utils/__pycache__/drive_document_processor.cpython-312.pyc differ
 
src/vectorstores/__pycache__/chroma_vectorstore.cpython-312.pyc CHANGED
Binary files a/src/vectorstores/__pycache__/chroma_vectorstore.cpython-312.pyc and b/src/vectorstores/__pycache__/chroma_vectorstore.cpython-312.pyc differ