增加聊天敏感词过滤
This commit is contained in:
parent
bf7d4dba8e
commit
5f009adf7a
@ -3,6 +3,8 @@ import 'dart:convert';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart';
|
import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart';
|
||||||
import 'package:circle_app/main.dart';
|
import 'package:circle_app/main.dart';
|
||||||
|
import 'package:circle_app/network/api.dart';
|
||||||
|
import 'package:circle_app/network/dio_manager.dart';
|
||||||
import 'package:circle_app/util/util.dart';
|
import 'package:circle_app/util/util.dart';
|
||||||
import 'package:diff_match_patch/diff_match_patch.dart';
|
import 'package:diff_match_patch/diff_match_patch.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_setting_model.dart';
|
import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_setting_model.dart';
|
||||||
@ -258,7 +260,7 @@ class _InputTextFieldState extends TIMUIKitState<TIMInputTextField> {
|
|||||||
|
|
||||||
onSubmitted() async {
|
onSubmitted() async {
|
||||||
lastText = "";
|
lastText = "";
|
||||||
final text = textEditingController.text.trim();
|
String text = textEditingController.text.trim();
|
||||||
final convType = widget.conversationType;
|
final convType = widget.conversationType;
|
||||||
|
|
||||||
if (text.isEmpty) {
|
if (text.isEmpty) {
|
||||||
@ -315,6 +317,19 @@ class _InputTextFieldState extends TIMUIKitState<TIMInputTextField> {
|
|||||||
convID: widget.conversationID,
|
convID: widget.conversationID,
|
||||||
atUserList: getUserIdFromMemberInfoMap());
|
atUserList: getUserIdFromMemberInfoMap());
|
||||||
} else {
|
} else {
|
||||||
|
var data =
|
||||||
|
await DioManager.instance.post(
|
||||||
|
url: Api.shieldWordCheck, params: {'text': text, 'type': 2});
|
||||||
|
|
||||||
|
if (data['data']['code'] == 10000) {
|
||||||
|
List words = data['data']['words'];
|
||||||
|
if (words.isNotEmpty) {
|
||||||
|
for(int i = 0; i < words.length; i++) {
|
||||||
|
text = text.replaceAll(words[i], '*');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
widget.model.sendTextMessage(
|
widget.model.sendTextMessage(
|
||||||
text: text, convID: widget.conversationID, convType: convType),
|
text: text, convID: widget.conversationID, convType: convType),
|
||||||
|
|||||||
@ -235,4 +235,8 @@ class Api {
|
|||||||
//系统通知
|
//系统通知
|
||||||
static const getNotices = 'msg-service/system/notices';
|
static const getNotices = 'msg-service/system/notices';
|
||||||
|
|
||||||
|
|
||||||
|
//敏感词-屏蔽词 校验
|
||||||
|
static const shieldWordCheck = 'msg-service/word/check';
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user