feat: integrate Sensei Spook mascot in 4 stances, speech bubbles, and style updates
This commit is contained in:
commit
e04672db2a
104 files changed
+8262
No files matched your search
@@ -0,0 +1,28 @@
|
||||
export class ContentSafetyError extends Error {
|
||||
public readonly isSafetyRejection = true;
|
||||
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = "ContentSafetyError";
|
||||
Object.setPrototypeOf(this, ContentSafetyError.prototype);
|
||||
}
|
||||
}
|
||||
|
||||
export function isContentSafetyError(err: any): boolean {
|
||||
if (!err) return false;
|
||||
if (err.isSafetyRejection || err.name === "ContentSafetyError") return true;
|
||||
|
||||
const msg = String(err.message || err.error || err || "").toLowerCase();
|
||||
return (
|
||||
msg.includes("safety filter") ||
|
||||
msg.includes("prohibited_content") ||
|
||||
msg.includes("harm_category") ||
|
||||
msg.includes("safe-for-work") ||
|
||||
msg.includes("finishreason: safety") ||
|
||||
msg.includes("finishreason: blocklist") ||
|
||||
msg.includes("blockreason") ||
|
||||
msg.includes("content safety") ||
|
||||
msg.includes("safety policy") ||
|
||||
msg.includes("violates safety")
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user