Add content policy checks and rate limiting

This commit is contained in:
Riccardo Giorato
2026-01-05 23:06:30 +01:00
parent 745b9d0ab5
commit 24c1f733b3
6 changed files with 117 additions and 48 deletions
+4
View File
@@ -145,4 +145,8 @@ export async function getNextPageNumber(storyId: string): Promise<number> {
export async function deletePage(pageId: string): Promise<void> {
await db.delete(pages).where(eq(pages.id, pageId));
}
export async function deleteStory(storyId: string): Promise<void> {
await db.delete(stories).where(eq(stories.id, storyId));
}
+14
View File
@@ -7,3 +7,17 @@ export function cn(...inputs: ClassValue[]) {
export const TOGETHER_LINK =
"https://togetherai.link/?utm_source=make-comics&utm_medium=referral&utm_campaign=example-app";
export function isContentPolicyViolation(errorMessage: string): boolean {
return (
errorMessage.includes("content policy") ||
errorMessage.includes("Invalid content detected") ||
errorMessage.includes("content moderation") ||
errorMessage.includes("flagged and rejected") ||
errorMessage.includes("NO_IMAGE")
);
}
export function getContentPolicyErrorMessage(): string {
return "Unable to generate image due to content policy. Please try a different prompt.";
}