Files
wordpress-theme-aksrt/assets/admin/src/schema/sections/extensions/audit.js
T

68 lines
2.6 KiB
JavaScript

export const auditSchema = {
key: 'extensions.audit',
title: 'API内容审核',
icon: 'fa fas fa-shield-alt',
description: '配置第三方内容审核 API 接入、审核范围和失败回退策略。',
defaults: {
content_audit_enabled: false,
content_audit_provider: 'baidu',
content_audit_api_key: '',
content_audit_api_secret: '',
content_audit_text_enabled: true,
content_audit_image_enabled: false,
content_audit_on_failure: 'allow',
content_audit_log_enabled: true,
},
groups: [
{
key: 'provider',
title: '审核接口',
icon: 'fa fas fa-plug',
fields: [
{ key: 'content_audit_enabled', label: '启用内容审核', type: 'switch', default: false, help: '开启后将对接第三方内容审核 API' },
{
key: 'content_audit_provider',
label: '审核服务商',
type: 'radio',
default: 'baidu',
options: [
{ label: '百度内容审核', value: 'baidu' },
{ label: '关闭审核接口', value: 'null' },
],
dependsOn: { key: 'content_audit_enabled', value: true },
},
{ key: 'content_audit_api_key', label: 'API Key', type: 'input', default: '', dependsOn: { key: 'content_audit_enabled', value: true }, help: '百度智能云 API Key' },
{ key: 'content_audit_api_secret', label: 'Secret Key', type: 'input', default: '', dependsOn: { key: 'content_audit_enabled', value: true }, help: '百度智能云 Secret Key' },
],
},
{
key: 'scope',
title: '审核范围',
icon: 'fa fas fa-check',
fields: [
{ key: 'content_audit_text_enabled', label: '文本审核', type: 'switch', default: true, dependsOn: { key: 'content_audit_enabled', value: true } },
{ key: 'content_audit_image_enabled', label: '图片审核', type: 'switch', default: false, dependsOn: { key: 'content_audit_enabled', value: true } },
],
},
{
key: 'fallback',
title: '失败策略',
icon: 'fa fas fa-exclamation-triangle',
fields: [
{
key: 'content_audit_on_failure',
label: '审核失败时',
type: 'radio',
default: 'allow',
options: [
{ label: '放行', value: 'allow' },
{ label: '拦截', value: 'block' },
],
dependsOn: { key: 'content_audit_enabled', value: true },
},
{ key: 'content_audit_log_enabled', label: '记录审核日志', type: 'switch', default: true, dependsOn: { key: 'content_audit_enabled', value: true } },
],
},
],
}