":{"message":"Your request was rejected by the safety system. If you believe thi...
错误信息
HTTP 400: {"error":{"message":"Your request was rejected by the safety system. If you believe this is an error, contact us at Azure support ticket and include the request ID 1385f619-e254-47bf-aa9c-b9913462e765. (request id: 20261020140800770059925njQuCPZg)","type":"image_generation_user_error","param":"","code":"moderation_blocked"}
AI 解决方案
🌐 错误翻译
原文:Your request was rejected by the safety system. If you believe this is an error, contact us at Azure support ticket and include the request ID 1385f619-e254-47bf-aa9c-b9913462e765.
译文:您的请求被安全系统拒绝了。如果您认为这是错误,请通过 Azure 支持工单联系我们,并附上请求 ID 1385f619-e254-47bf-aa9c-b9913462e765。
🎯 原因分析
- 错误类型:
image_generation_user_error,属于图像生成过程中的用户侧错误 - 触发原因:请求内容被安全/内容审核系统拦截,
code: moderation_blocked明确表示请求被判定为违规 - 发生位置:图像生成接口的请求校验阶段,在服务端安全审核未通过
💡 解决方案
- 检查请求内容:确认请求中是否包含敏感、违规、暴力、色情等违反平台内容政策的描述或参数
- 调整提示词:对图像生成的提示词进行规范化处理,避免触发审核规则
// 修复后的安全提示词示例
const safePrompt = "一只可爱的卡通小猫在草地上玩耍,风格温馨治愈";
// 重新发起请求
const response = await imageGeneration({
prompt: safePrompt,
// 其他参数保持不变
});
- 若确认无误:可按报错提示,携带请求 ID 提交 Azure 支持工单,申请人工复核
🛡️ 预防措施
- ✅ 内容合规检查:在调用图像生成接口前,对提示词做本地合规过滤,屏蔽高风险关键词
- ✅ 错误日志记录:完整记录请求参数与报错信息,便于后续快速定位拦截原因
- 🛠️ 推荐工具:可使用内容安全审核工具(如 OpenAI Moderation API)对请求内容做预校验