diff --git a/application/api/user/routes.py b/application/api/user/routes.py index 8e62683e..7490d0fb 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -435,6 +435,8 @@ class CombinedJson(Resource): user = "local" sort_field = request.args.get('sort', 'date') # Default to 'date' sort_order = request.args.get('order', "desc") # Default to 'desc' + page = request.args.get('page', 1) # Default to 1 + rows_per_page = request.args.get('rows', 10) # Default to 10 data = [ { "name": "default", @@ -485,10 +487,15 @@ class CombinedJson(Resource): "retriever": "brave_search", } ) + + first_index = (int(page_number) - 1) * int(rows_per_page) + last_index = first_index + int(rows_per_page) + paginated_docs = data[first_index:last_index] + except Exception as err: return make_response(jsonify({"success": False, "error": str(err)}), 400) - return make_response(jsonify(data), 200) + return make_response(jsonify(paginated_docs), 200) @user_ns.route("/api/docs_check")