24 lines
504 B
Go
Raw Normal View History

2024-11-06 01:27:14 +08:00
package web
import (
"catface/app/global/consts"
2024-11-16 02:38:34 +08:00
"catface/app/service/nlp"
2024-11-06 01:27:14 +08:00
"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, "")
}
}