fix: agent log return zero total number (#17766)

### Summary

As title

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Haruko386
2026-08-04 15:03:58 +08:00
committed by GitHub
parent 57b3a7384d
commit 970be641a4
5 changed files with 27 additions and 11 deletions

View File

@@ -917,11 +917,14 @@ func (h *AgentHandler) ListAgentSessions(c *gin.Context) {
keywords := c.Query("keywords")
fromDate := c.Query("from_date")
toDate := c.Query("to_date")
orderby := c.DefaultQuery("orderby", "create_time")
desc := c.DefaultQuery("desc", "true") != "false"
orderby := c.DefaultQuery("orderby", "update_time")
descParam := c.Query("desc")
desc := descParam != "false" && descParam != "False"
sessionID := c.Query("id")
expUserID := c.Query("user_id")
includeDSL := c.Query("dsl") == "true"
queryUserID := c.Query("user_id")
expUserID := c.Query("exp_user_id")
dslParam := c.Query("dsl")
includeDSL := dslParam != "false" && dslParam != "False"
ctx := c.Request.Context()
resp, code, err := h.agentService.ListAgentSessions(ctx, user.ID, user.ID, canvasID, service.ListAgentSessionsRequest{
Page: page,
@@ -932,7 +935,7 @@ func (h *AgentHandler) ListAgentSessions(c *gin.Context) {
OrderBy: orderby,
Desc: desc,
SessionID: sessionID,
UserID: user.ID,
UserID: queryUserID,
ExpUserID: expUserID,
IncludeDSL: includeDSL,
})
@@ -940,7 +943,7 @@ func (h *AgentHandler) ListAgentSessions(c *gin.Context) {
common.ErrorWithCode(c, code, err.Error())
return
}
common.SuccessWithData(c, resp.Data, "success")
common.SuccessWithDataAndTotal(c, resp.Data, resp.Total, "success")
}
// CreateAgentSession POST /api/v1/agents/:canvas_id/sessions