kefu/controller/llm_log.go

34 lines
714 B
Go
Raw Permalink Normal View History

2024-12-10 02:50:12 +00:00
package controller
import (
"github.com/gin-gonic/gin"
"kefu/models"
"strconv"
)
func GetLlmLogList(c *gin.Context) {
entId, _ := c.Get("ent_id")
kefuName, _ := c.Get("kefu_name")
page, _ := strconv.Atoi(c.Query("page"))
if page <= 0 {
page = 1
}
pagesize, _ := strconv.Atoi(c.Query("pagesize"))
if pagesize <= 0 || pagesize > 50 {
pagesize = 10
}
count := models.CountLlmLogs("ent_id = ? and kefu_name = ?", entId, kefuName)
list := models.FindLlmLogs(page, pagesize, "ent_id = ? and kefu_name = ?", entId, kefuName)
c.JSON(200, gin.H{
"code": 200,
"msg": "ok",
"result": gin.H{
"list": list,
"count": count,
"pagesize": uint(pagesize),
"page": page,
},
})
}