{t('home:features.in_page.title')}
{t('home:features.in_page.desc')}
/* eslint-disable react-dom/no-dangerously-set-innerhtml */ import { Bot, Box, MessageSquare, PlayCircle, Shield, Sparkles, Users, Zap } from 'lucide-react' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Link, useSearchParams } from 'wouter' import Footer from '../components/Footer' import Header from '../components/Header' import { AnimatedGradientText } from '../components/ui/animated-gradient-text' import { Highlighter } from '../components/ui/highlighter' import { NeonGradientCard } from '../components/ui/neon-gradient-card' import { Particles } from '../components/ui/particles' import { SparklesText } from '../components/ui/sparkles-text' import { CDN_DEMO_CN_URL, CDN_DEMO_URL, DEMO_API_KEY, DEMO_BASE_URL, DEMO_MODEL, } from '../constants' function getInjection(useCN?: boolean) { const cdn = useCN ? CDN_DEMO_CN_URL : CDN_DEMO_URL const injection = encodeURI( `javascript:(function(){var s=document.createElement('script');s.src=\`${cdn}?t=\${Math.random()}\`;s.setAttribute('crossorigin', true);s.type="text/javascript";s.onload=()=>console.log('PageAgent script loaded!');document.body.appendChild(s);})();` ) return ` ✨PageAgent ` } export default function HomePage() { const { t, i18n } = useTranslation(['home', 'common']) const [task, setTask] = useState(() => t('home:hero.default_task')) // Update task when language changes const defaultTask = t('home:hero.default_task') useEffect(() => { setTask(defaultTask) }, [defaultTask]) const [params, setParams] = useSearchParams() const isOther = params.has('try_other') const [activeTab, setActiveTab] = useState<'try' | 'other'>(isOther ? 'other' : 'try') const [cdnSource, setCdnSource] = useState<'international' | 'china'>('international') const handleExecute = async () => { if (!task.trim()) return const win = window as any // Lazy load PageAgent only when user clicks execute if (!win.pageAgent || win.pageAgent.disposed) { const { PageAgent } = await import('page-agent') win.pageAgent = new PageAgent({ // 把 react 根元素排除掉,挂了很多冒泡时间导致假阳 interactiveBlacklist: [document.getElementById('root')!], language: i18n.language as any, instructions: { system: 'You are a helpful assistant on PageAgent website.', getPageInstructions: (url) => { const hint = url.includes('page-agent') ? 'This is PageAgent demo page.' : undefined console.log('[instructions] getPageInstructions:', url, '->', hint) return hint }, }, model: import.meta.env.DEV && import.meta.env.LLM_MODEL_NAME ? import.meta.env.LLM_MODEL_NAME : DEMO_MODEL, baseURL: import.meta.env.DEV && import.meta.env.LLM_BASE_URL ? import.meta.env.LLM_BASE_URL : DEMO_BASE_URL, apiKey: import.meta.env.DEV && import.meta.env.LLM_API_KEY ? import.meta.env.LLM_API_KEY : DEMO_API_KEY, }) } const result = await win.pageAgent.execute(task) console.log(result) } return (
{t('home:hero.subtitle_detail')}
{t('home:try_other.step1_title')} {' '} {t('home:try_other.step1_content')}
{t('home:try_other.step2_title')} {' '} {t('home:try_other.step2_content')}
{t('home:try_other.step3_title')} {' '} {t('home:try_other.step3_content')}
{t('home:features.in_page.desc')}
{t('home:features.zero_backend.desc')}
{t('home:features.accessible.desc')}
{t('home:features.secure_integration.desc')}
{t('home:use_cases.section_subtitle')}
{t('home:use_cases.case1.desc')}
{t('home:use_cases.case2.desc')}
{t('home:use_cases.case3.desc')}
{t('home:use_cases.case4.desc')}