Normalize chat sorting defaults in developer API (#3270)

* normalize sorting for workspace and workspace thread chats in dev api

* lint

---------

Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
This commit is contained in:
Sean Hatfield 2025-02-19 12:50:22 +08:00 committed by GitHub
parent 12b43256a0
commit e53ec1474e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -411,7 +411,7 @@ function apiWorkspaceEndpoints(app) {
const {
apiSessionId = null,
limit = 100,
orderBy = "desc",
orderBy = "asc",
} = request.query;
const workspace = await Workspace.get({ slug });
@ -423,7 +423,7 @@ function apiWorkspaceEndpoints(app) {
const validLimit = Math.max(1, parseInt(limit));
const validOrderBy = ["asc", "desc"].includes(orderBy)
? orderBy
: "desc";
: "asc";
const history = apiSessionId
? await WorkspaceChats.forWorkspaceByApiSessionId(