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
+11 -5
View File
@@ -10,6 +10,7 @@ import { useAuth, SignInButton } from "@clerk/nextjs";
import { COMIC_STYLES } from "@/lib/constants";
import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut";
import { useApiKey } from "@/hooks/use-api-key";
import { isContentPolicyViolation } from "@/lib/utils";
interface ComicCreationFormProps {
prompt: string;
@@ -171,12 +172,17 @@ export function ComicCreationForm({
router.push(`/story/${result.storySlug}`);
} catch (error) {
console.error("Error creating comic:", error);
const errorMessage =
error instanceof Error
? error.message
: "Failed to create comic. Please try again.";
let title = "Creation failed";
if (isContentPolicyViolation(errorMessage)) {
title = "Content policy violation";
}
toast({
title: "Creation failed",
description:
error instanceof Error
? error.message
: "Failed to create comic. Please try again.",
title,
description: errorMessage,
variant: "destructive",
duration: 4000,
});