":{"message":"[BadRequestError] Your request was rejected by the safety system. ...
错误信息
PI 错误 400: {"error":{"message":"[BadRequestError] Your request was rejected by the safety system. If you believe this is an error, contact us at ***.***.com and include the request ID req_b1c0d03f80a44efbb30095dc3e483b8b. safety_violations=[sexual]. (request_id: chatimagegen-0295a14a5f3c4b29b2d0d53f13a5c94b)","type":"invalid_request_error","param":"","code":"moderation_blocked"}}
AI 解决方案
1. 🌐 错误翻译
原文:[BadRequestError] Your request was rejected by the safety system. If you believe this is an error, contact us at ***.***.com and include the request ID req_b1c0d03f80a44efbb30095dc3e483b8b. safety_violations=[sexual]. (request_id: chatimagegen-0295a14a5f3c4b29b2d0d53f13a5c94b)
译文:[BadRequestError] 您的请求被安全系统拒绝。如果您认为这是一个错误,请通过 ***.***.com 联系我们,并附上请求 ID req_b1c0d03f80a44efbb30095dc3e483b8b。安全违规类别=[性相关]。(请求 ID:chatimagegen-0295a14a5f3c4b29b2d0d53f13a5c94b)
2. 🎯 原因分析
3. 💡 解决方案
示例修复逻辑(假设原请求是图像生成,需修改提示词):
``代码语言
// ❌ 违规请求示例(含性相关描述)
const originalPrompt = "Generate an image of a seductive woman in lingerie";
// ✅ 合规请求示例(正向内容)
const fixedPrompt = "Generate an image of a woman reading a book in a cozy library";
// 发起合规请求
const response = await piAPI.generateContent({
prompt: fixedPrompt,
// 其他合规参数...
});
``