Research Wizard and CopilotKit mitigation review

This commit is contained in:
ajaysi
2025-11-04 08:11:57 +05:30
parent e69107b07c
commit 55087c4f37
27 changed files with 2167 additions and 277 deletions

View File

@@ -26,8 +26,22 @@ const SEOCopilotKitProvider: React.FC<SEOCopilotKitProviderProps> = ({
} = useSEOCopilotStore();
const { analysisData } = useSEOCopilotStore();
// Get the CopilotKit API key from environment variables
const publicApiKey = process.env.REACT_APP_COPILOTKIT_API_KEY;
// Get the CopilotKit API key from the same sources as App.tsx
// Check localStorage first, then fall back to environment variable
const publicApiKey = useMemo(() => {
const savedKey = typeof window !== 'undefined'
? localStorage.getItem('copilotkit_api_key')
: null;
const envKey = process.env.REACT_APP_COPILOTKIT_API_KEY || '';
const key = (savedKey || envKey).trim();
// Validate key format if present
if (key && !key.startsWith('ck_pub_')) {
console.warn('SEOCopilotKitProvider: CopilotKit API key format invalid - must start with ck_pub_');
}
return key;
}, []);
// Derive a friendly site/brand name from the URL for personalization
const domainRootName = useMemo(() => {