From 3b49264b242b043153eb237ccfca5cc1f0324785 Mon Sep 17 00:00:00 2001 From: Suraj Jha Date: Sat, 9 Aug 2025 17:41:57 +0545 Subject: [PATCH] fix: show notice for gpt-5 api key requirement --- .../components/AnthropicKeyWarning.tsx | 20 ------------------- .../hooks/useAnthropicKeyCheck.ts | 17 ---------------- .../custom-layout/page.tsx | 16 +++++++-------- 3 files changed, 8 insertions(+), 45 deletions(-) delete mode 100644 servers/nextjs/app/(presentation-generator)/custom-layout/components/AnthropicKeyWarning.tsx delete mode 100644 servers/nextjs/app/(presentation-generator)/custom-layout/hooks/useAnthropicKeyCheck.ts diff --git a/servers/nextjs/app/(presentation-generator)/custom-layout/components/AnthropicKeyWarning.tsx b/servers/nextjs/app/(presentation-generator)/custom-layout/components/AnthropicKeyWarning.tsx deleted file mode 100644 index 68d8e565..00000000 --- a/servers/nextjs/app/(presentation-generator)/custom-layout/components/AnthropicKeyWarning.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from "react"; -import Header from "@/components/Header"; - -export const AnthropicKeyWarning: React.FC = () => { - return ( -
-
-
-
-

- Please put Anthropic Key To Process The Layout -

-

- It Only works on Anthropic(Claude-4). -

-
-
-
- ); -}; \ No newline at end of file diff --git a/servers/nextjs/app/(presentation-generator)/custom-layout/hooks/useAnthropicKeyCheck.ts b/servers/nextjs/app/(presentation-generator)/custom-layout/hooks/useAnthropicKeyCheck.ts deleted file mode 100644 index e6bdd684..00000000 --- a/servers/nextjs/app/(presentation-generator)/custom-layout/hooks/useAnthropicKeyCheck.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useState, useEffect } from "react"; - -export const useAnthropicKeyCheck = () => { - const [hasAnthropicKey, setHasAnthropicKey] = useState(false); - const [isAnthropicKeyLoading, setIsAnthropicKeyLoading] = useState(true); - - useEffect(() => { - fetch("/api/has-anthropic-key") - .then((res) => res.json()) - .then((data) => { - setHasAnthropicKey(data.hasKey); - setIsAnthropicKeyLoading(false); - }); - }, []); - - return { hasAnthropicKey, isAnthropicKeyLoading }; -}; \ No newline at end of file diff --git a/servers/nextjs/app/(presentation-generator)/custom-layout/page.tsx b/servers/nextjs/app/(presentation-generator)/custom-layout/page.tsx index 377175dc..eabe6e06 100644 --- a/servers/nextjs/app/(presentation-generator)/custom-layout/page.tsx +++ b/servers/nextjs/app/(presentation-generator)/custom-layout/page.tsx @@ -9,9 +9,9 @@ import { useFontManagement } from "./hooks/useFontManagement"; import { useFileUpload } from "./hooks/useFileUpload"; import { useSlideProcessing } from "./hooks/useSlideProcessing"; import { useLayoutSaving } from "./hooks/useLayoutSaving"; -import { useAnthropicKeyCheck } from "./hooks/useAnthropicKeyCheck"; +import { useOpenAIKeyCheck } from "./hooks/useOpenAIKeyCheck"; import { LoadingSpinner } from "./components/LoadingSpinner"; -import { AnthropicKeyWarning } from "./components/AnthropicKeyWarning"; +import { OpenAIKeyWarning } from "./components/OpenAIKeyWarning"; import { FileUploadSection } from "./components/FileUploadSection"; import { SaveLayoutButton } from "./components/SaveLayoutButton"; import { SaveLayoutModal } from "./components/SaveLayoutModal"; @@ -22,7 +22,7 @@ const CustomLayoutPage = () => { const { refetch } = useLayout(); // Custom hooks for different concerns - const { hasAnthropicKey, isAnthropicKeyLoading } = useAnthropicKeyCheck(); + const { hasOpenAIKey, isOpenAIKeyLoading } = useOpenAIKeyCheck(); const { selectedFile, handleFileSelect, removeFile } = useFileUpload(); const { slides, setSlides, completedSlides } = useCustomLayout(); const { fontsData, UploadedFonts, uploadFont, removeFont, getAllUnsupportedFonts, setFontsData } = useFontManagement(); @@ -58,13 +58,13 @@ const CustomLayoutPage = () => { }; // Loading state - if (isAnthropicKeyLoading) { - return ; + if (isOpenAIKeyLoading) { + return ; } - // Anthropic key warning - if (!hasAnthropicKey) { - return ; + // OpenAI key warning + if (!hasOpenAIKey) { + return ; } return (