Add content policy checks and rate limiting
This commit is contained in:
@@ -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));
|
||||
}
|
||||
@@ -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.";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user