feat(moderation): add Tencent TMS as fallback for AI content moderation
Add Tencent Cloud Text Moderation System (TMS) as a fallback moderation service when OpenAI is unavailable or returns an error. The service now checks OpenAI first, and falls back to Tencent TMS if it fails, providing better reliability for content moderation. Features: - New Tencent TMS configuration in config.yaml with environment variable overrides - New tencent package in internal/pkg/tencent/ with TMS client implementation - PostAIService now uses dual moderation with OpenAI primary and Tencent fallback - Strict mode configuration passed to PostAIService for consistent behavior BREAKING CHANGE: NewPostAIService now requires tencentClient and strictMode parameters - update wire configuration accordingly.
This commit is contained in:
@@ -176,6 +176,19 @@ openai:
|
||||
request_timeout: 30
|
||||
strict_moderation: false
|
||||
|
||||
# 腾讯云文本内容安全配置(作为 OpenAI 备用)
|
||||
# 当 OpenAI 不可用或审核失败时,使用腾讯TMS进行文本审核
|
||||
# 环境变量:
|
||||
# APP_TENCENT_TMS_ENABLED, APP_TENCENT_TMS_SECRET_ID, APP_TENCENT_TMS_SECRET_KEY
|
||||
# APP_TENCENT_TMS_REGION, APP_TENCENT_TMS_BIZ_TYPE, APP_TENCENT_TMS_TIMEOUT
|
||||
tencent_tms:
|
||||
enabled: false
|
||||
secret_id: ""
|
||||
secret_key: ""
|
||||
region: "ap-guangzhou"
|
||||
biz_type: "" # 可选,使用控制台配置的自定义策略
|
||||
timeout: 30
|
||||
|
||||
# SMTP发信配置(gomail.v2)
|
||||
# 环境变量:
|
||||
# APP_EMAIL_ENABLED, APP_EMAIL_HOST, APP_EMAIL_PORT
|
||||
|
||||
Reference in New Issue
Block a user