|
@@ -34,9 +34,12 @@ func (m *WsChat) Handle(ws *ghttp.WebSocket, msg []byte) {
|
|
|
glog.Errorf(m.Ctx, "%d 接收消息Unmarshal出错:%v", jSession.AccountId, err)
|
|
|
return
|
|
|
}
|
|
|
- // 问题敏感词过滤
|
|
|
- req.Prompt = fsw.Repl(req.Prompt)
|
|
|
+
|
|
|
reply, errMsg := func() (string, error) {
|
|
|
+ // 问题敏感词过滤
|
|
|
+ if fsw.Match(req.Prompt) {
|
|
|
+ return "", fmt.Errorf(g.Cfg().MustGet(m.Ctx, "limit.fswMsg", "您的问题可能包含敏感词汇,请修改后再提问!").String())
|
|
|
+ }
|
|
|
reply, from, err := Question.DetailQuestion(m.Ctx, req)
|
|
|
// 回答敏感词过滤
|
|
|
reply = fsw.Repl(reply)
|