@tiog/ace
v1.0.7
Published
tig ace api
Readme
ACE内容安全过滤组件
安装:
// 内网安装
npm i @tencent/tig-ace
// 外网安装(适用于云函数自动安装依赖)
npm i @tiog/ace文档
接口调用
1、初始化
const ace = new Ace('ace_ugc_326', 'xxxxxx');
const account: AccountInfo = {
// 用户id
account: '100086',
// 用户昵称
role_name: 'tianxia',
// 平台id:无意义
plat_id: 2,
};2、批量文本安全检测
const res = await ace.checkBatchText([{
// 场景id:用户信息场景为101
scene_id: 101,
text: '大**',
account,
}]);
console.log(res);
// 打印:
{
err_code: 0,
err_msg: 'succ',
data: [
{
err_code: 0,
err_msg: ';Account[10086]',
data_id: '',
request_id: '1691403776-7953-5116675-4228905_326_10086',
text_check_result: [Object]
}
]
}
console.log(res.data?.[0].text_check_result);
// 打印:
{
check_result: 1,
filtered_text: '大**',
label: 106,
check_desc: '[Text] hit policy_model; '
}3、批量图片检测
const res = await ace.checkBatchPicture([
{
scene_id: 103,
url: 'https://tigimg-1252093452.image.myqcloud.com/2022/05/31/ZhRVYYJfLUQtmZxFTsXa.png',
pic_type: 1,
account,
},
]);
console.log(res);
// 返回:
{
err_code: 0,
err_msg: 'succ',
data: [
{
err_code: 0,
err_msg: 'OK;Account[10086]',
data_id: '',
request_id: '1691404913-180-4408563-63900549_326_10086',
label: 102,
check_desc: '命中策略130065'
}
]
}4、文章内容检测
const result = await ace.checkArticle(
3001,
{
id: '100086',
title: '游戏开发方法论总结',
description: '唱支山歌给党听',
content: '游戏开发方法论总结',
pictures: []
},
account,
);
console.log(result);
// 打印:
{
err_code: 0,
err_msg: 'succ',
data: {
request_id: '326_tianxia_1649220420714_61841514',
text_check_result: {
check_result: 2,
filtered_text: '********',
label: 101,
check_desc: '[TongQue] hit comm_black'
},
pic_check_results: []
}
}