kefu/controller/ai/chatCollects.go

40 lines
1.1 KiB
Go

package ai
import (
"github.com/gin-gonic/gin"
"kefu/models"
"kefu/types"
)
func GetChatCollects(c *gin.Context) {
entId, _ := c.Get("ent_id")
kefuName, _ := c.Get("kefu_name")
collects := models.FindAigcSessionCollects(0, 100, "kefu_name = ? and ent_id = ?", kefuName, entId)
c.JSON(200, gin.H{
"code": types.ApiCode.SUCCESS,
"msg": types.ApiCode.GetMessage(types.ApiCode.SUCCESS),
"result": collects,
})
}
func GetCleanChatCollects(c *gin.Context) {
entId, _ := c.Get("ent_id")
kefuName, _ := c.Get("kefu_name")
models.DelAigcSessionCollects("kefu_name = ? and ent_id = ?", kefuName, entId)
c.JSON(200, gin.H{
"code": types.ApiCode.SUCCESS,
"msg": types.ApiCode.GetMessage(types.ApiCode.SUCCESS),
})
}
func GetChatSessions(c *gin.Context) {
collectId := c.Query("collect_id")
entId, _ := c.Get("ent_id")
kefuName, _ := c.Get("kefu_name")
collects := models.FindAigcSessionMessage(0, 100, "kefu_name = ? and ent_id = ? and collect_id = ?", kefuName, entId, collectId)
c.JSON(200, gin.H{
"code": types.ApiCode.SUCCESS,
"msg": types.ApiCode.GetMessage(types.ApiCode.SUCCESS),
"result": collects,
})
}