From 10eb12648ddb93f7b90f11f20a0dec2c1777f142 Mon Sep 17 00:00:00 2001 From: Gemini AI Date: Mon, 29 Dec 2025 16:13:12 +0400 Subject: [PATCH] feat: add AI Instruction Enhancer and improve comprehensive data export --- components/GoogleAdsGenerator.tsx | 45 ++++++++- lib/export-utils.ts | 151 +++++++++++++----------------- 2 files changed, 108 insertions(+), 88 deletions(-) diff --git a/components/GoogleAdsGenerator.tsx b/components/GoogleAdsGenerator.tsx index df13c30..6837420 100644 --- a/components/GoogleAdsGenerator.tsx +++ b/components/GoogleAdsGenerator.tsx @@ -50,6 +50,7 @@ export default function GoogleAdsGenerator() { const [expandedSections, setExpandedSections] = useState(["keywords"]); const [isMagicThinking, setIsMagicThinking] = useState(false); + const [isEnhancing, setIsEnhancing] = useState(false); const [progressMessage, setProgressMessage] = useState(""); const [progressIndex, setProgressIndex] = useState(0); @@ -296,6 +297,32 @@ export default function GoogleAdsGenerator() { } }; + const handleEnhanceInstructions = async () => { + if (!specialInstructions.trim()) return; + + setIsEnhancing(true); + setError(null); + + try { + const result = await modelAdapter.enhancePrompt( + specialInstructions, + selectedProvider, + selectedModel + ); + + if (result.success && result.data) { + setSpecialInstructions(result.data); + } else { + setError(result.error || "Failed to enhance instructions"); + } + } catch (err) { + console.error("[GoogleAdsGenerator] Enhancement error:", err); + setError(err instanceof Error ? err.message : "Instruction enhancement failed"); + } finally { + setIsEnhancing(false); + } + }; + const handleCopy = async () => { const content = googleAdsResult?.rawContent || magicWandResult?.rawContent; if (content) { @@ -1017,7 +1044,23 @@ export default function GoogleAdsGenerator() {
- +
+ + +