Documentation ¶
Index ¶
- func ExtractChinese(word string) string
- func ExtractEnglish(word string) string
- func PruneText(word string) (string, string)
- func Tc2Cn(word string) string
- type ContentSafe
- func (c *ContentSafe) AddWords(wordList ...string)
- func (c *ContentSafe) AutoHitImg(uri string) (bool, error)
- func (c *ContentSafe) AutoHitText(content string) (success bool, message string)
- func (c *ContentSafe) ClearText(words string) string
- func (c *ContentSafe) DownloadImage(remoteUri string) (savePath string, fileName string, err error)
- func (c *ContentSafe) FetchNsfw(remoteUri string) (*Prediction, error)
- func (c *ContentSafe) GetToken() string
- func (c *ContentSafe) HitImgHandler(ctx iris.Context)
- func (c *ContentSafe) HitText(content string) (bool, string)
- func (c *ContentSafe) HitTextHandler(ctx iris.Context)
- func (c *ContentSafe) InitLadClient() error
- func (c *ContentSafe) RegistryRouters(party iris.Party)
- func (c *ContentSafe) SetGetTokenFunc(getTokenFunc func() string)
- func (c *ContentSafe) WxImgCheckV1(remoteUri string) (bool, error)
- func (c *ContentSafe) WxTextCheckV1(content string) (bool, error, string)
- type HitImgReq
- type Prediction
- type WordHitResp
- type WordValidReq
- type WxImgV1Resp
- type WxTextV1Resp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContentSafe ¶
type ContentSafe struct { NsfwHost string TmpSaveBase string // contains filtered or unexported fields }
var (
C *ContentSafe
)
func NewSafeClient ¶
func NewSafeClient() *ContentSafe
func (*ContentSafe) AddWords ¶
func (c *ContentSafe) AddWords(wordList ...string)
func (*ContentSafe) AutoHitImg ¶
func (c *ContentSafe) AutoHitImg(uri string) (bool, error)
AutoHitImg 检测是否为正常图片
func (*ContentSafe) AutoHitText ¶
func (c *ContentSafe) AutoHitText(content string) (success bool, message string)
func (*ContentSafe) ClearText ¶
func (c *ContentSafe) ClearText(words string) string
func (*ContentSafe) DownloadImage ¶
func (c *ContentSafe) DownloadImage(remoteUri string) (savePath string, fileName string, err error)
func (*ContentSafe) FetchNsfw ¶
func (c *ContentSafe) FetchNsfw(remoteUri string) (*Prediction, error)
func (*ContentSafe) GetToken ¶
func (c *ContentSafe) GetToken() string
func (*ContentSafe) HitImgHandler ¶
func (c *ContentSafe) HitImgHandler(ctx iris.Context)
func (*ContentSafe) HitTextHandler ¶
func (c *ContentSafe) HitTextHandler(ctx iris.Context)
func (*ContentSafe) InitLadClient ¶
func (c *ContentSafe) InitLadClient() error
func (*ContentSafe) RegistryRouters ¶
func (c *ContentSafe) RegistryRouters(party iris.Party)
func (*ContentSafe) SetGetTokenFunc ¶
func (c *ContentSafe) SetGetTokenFunc(getTokenFunc func() string)
func (*ContentSafe) WxImgCheckV1 ¶
func (c *ContentSafe) WxImgCheckV1(remoteUri string) (bool, error)
WxImgCheckV1 返回的是 是否为正常图片
func (*ContentSafe) WxTextCheckV1 ¶
func (c *ContentSafe) WxTextCheckV1(content string) (bool, error, string)
type HitImgReq ¶
type HitImgReq struct {
Uri string `json:"uri" form:"uri" comment:"图片地址" validate:"required"`
}
type Prediction ¶
type Prediction struct { Drawings float32 `json:"drawings"` // 无害的艺术,或艺术绘画 最高100分 Hentai float32 `json:"hentai"` // 色情艺术,不适合大多数工作环境 Neutral float32 `json:"neutral"` // 一般,无害的内容 Porn float32 `json:"porn"` // 不雅的内容和行为,通常涉及生殖器 性行为等 Sexy float32 `json:"sexy"` // 性感 但无色情 }
func (*Prediction) IsNsfw ¶
func (c *Prediction) IsNsfw() bool
type WordHitResp ¶
type WordValidReq ¶
type WordValidReq struct {
Content string `json:"content" comment:"内容" validate:"required,max=2000"` // 尽量不要有长字符
}
type WxImgV1Resp ¶
type WxTextV1Resp ¶
Click to show internal directories.
Click to hide internal directories.