refactor: reuse global aliyun moderation config
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
-- 阿里云文本审核统一复用 hg_sys_config.im_third_party 中的公共凭证、地域和端点。
|
||||
-- 可重复执行;清理 im_external_config 中历史重复保存的密钥和连接参数。
|
||||
|
||||
INSERT INTO `im_external_config`
|
||||
(`tenant_id`, `service`, `provider`, `endpoint`, `enabled`, `status`, `config_json`, `secret_json`, `created_by`, `updated_by`)
|
||||
SELECT
|
||||
t.`id`,
|
||||
'moderation',
|
||||
'aliyun_green',
|
||||
'',
|
||||
1,
|
||||
'unconfigured',
|
||||
JSON_OBJECT(
|
||||
'nickname_service', 'nickname_detection_pro',
|
||||
'chat_service', 'chat_detection_pro',
|
||||
'timeout_ms', 1500,
|
||||
'failure_mode', 'allow'
|
||||
),
|
||||
JSON_OBJECT(),
|
||||
0,
|
||||
0
|
||||
FROM `im_tenant` t
|
||||
WHERE t.`code` = 'default'
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`provider` = VALUES(`provider`),
|
||||
`endpoint` = VALUES(`endpoint`),
|
||||
`enabled` = VALUES(`enabled`),
|
||||
`status` = VALUES(`status`),
|
||||
`config_json` = VALUES(`config_json`),
|
||||
`secret_json` = VALUES(`secret_json`),
|
||||
`checked_at` = NULL,
|
||||
`check_result` = '',
|
||||
`updated_at` = CURRENT_TIMESTAMP;
|
||||
@@ -112,20 +112,27 @@ IM Server
|
||||
|
||||
#### 6.1 阿里云服务配置
|
||||
|
||||
复用 `im_external_config` 的 `service=moderation`,只允许平台管理员维护:
|
||||
复用 `im_external_config` 的 `service=moderation`,只允许平台管理员维护审核策略参数。阿里云账号与连接参数统一复用 `hg_sys_config` 的 `im_third_party` 分组,不在商户审核配置中重复保存:
|
||||
|
||||
| 配置 | 说明 |
|
||||
| --- | --- |
|
||||
| `provider` | 固定 `aliyun_green` |
|
||||
| `endpoint` | 默认 `green-cip.cn-shanghai.aliyuncs.com` |
|
||||
| `enabled` | 平台总开关 |
|
||||
| `config_json.region_id` | 默认 `cn-shanghai` |
|
||||
| `config_json.nickname_service` | 默认 `nickname_detection_pro` |
|
||||
| `config_json.chat_service` | 默认 `chat_detection_pro` |
|
||||
| `config_json.timeout_ms` | 单次请求超时,建议 1000~2000 ms |
|
||||
| `config_json.failure_mode` | `allow` 或 `block` |
|
||||
| `secret_json.access_key_id` | 只写不回显 |
|
||||
| `secret_json.access_key_secret` | 只写不回显 |
|
||||
|
||||
公共配置来源如下:
|
||||
|
||||
| `hg_sys_config` 键 | 说明 |
|
||||
| --- | --- |
|
||||
| `im_third_party.aliyun_access_key_id` | 阿里云 AccessKey ID |
|
||||
| `im_third_party.aliyun_access_key_secret` | 阿里云 AccessKey Secret |
|
||||
| `im_third_party.aliyun_green_region_id` | 内容安全地域,默认 `cn-shanghai` |
|
||||
| `im_third_party.aliyun_green_endpoint` | 内容安全端点,默认 `green-cip.cn-shanghai.aliyuncs.com` |
|
||||
|
||||
`im_external_config.secret_json` 不再保存内容审核密钥;升级时清空历史重复密钥。Admin Server 的内部接口负责把平台总开关、场景服务参数和公共阿里云配置合并后下发给 IM Server。
|
||||
|
||||
“检查配置”必须真实调用阿里云测试文本,返回成功与否、耗时、RequestID 和脱敏错误,不能只检查字段非空。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user