2024-11-16 02:38:34 +08:00

24 lines
504 B
Go

package web
import (
"catface/app/global/consts"
"catface/app/service/nlp"
"catface/app/utils/response"
"github.com/gin-gonic/gin"
)
type Nlp struct {
}
func (n *Nlp) Title(context *gin.Context) {
content := context.GetString(consts.ValidatorPrefix + "content")
newTitle := nlp.GenerateTitle(content)
if newTitle != "" {
response.Success(context, consts.CurdStatusOkMsg, gin.H{"title": newTitle})
} else {
response.Fail(context, consts.CurdStatusOkCode, consts.CurdStatusOkMsg, "")
}
}