mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 17:13:15 +00:00
fix sorting on /sources
This commit is contained in:
@@ -485,8 +485,6 @@ class CombinedJson(Resource):
|
||||
@api.doc(description="Provide JSON file with combined available indexes")
|
||||
def get(self):
|
||||
user = "local"
|
||||
sort_field = request.args.get("sort", "date") # Default to 'date'
|
||||
sort_order = request.args.get("order", "desc") # Default to 'desc'
|
||||
data = [
|
||||
{
|
||||
"name": "default",
|
||||
@@ -500,7 +498,7 @@ class CombinedJson(Resource):
|
||||
|
||||
try:
|
||||
for index in sources_collection.find({"user": user}).sort(
|
||||
sort_field, 1 if sort_order == "asc" else -1
|
||||
"date", -1
|
||||
):
|
||||
data.append(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user