/* eslint-disable react-dom/no-dangerously-set-innerhtml */ import { Bot, Box, ExternalLink, MessageSquare, PlayCircle, Shield, Sparkles, Users, Zap, } from 'lucide-react' import { useEffect, useState } from 'react' import { siGooglechrome } from 'simple-icons' 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' import { useLanguage } from '../i18n/context' 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 { language, isZh } = useLanguage() const defaultTask = isZh ? '从导航栏中进入文档页,打开"快速开始"相关的文档,帮我总结成 markdown' : 'Goto docs in navigation bar, find Quick-Start section, and summarize in markdown' const [task, setTask] = useState(() => defaultTask) // Update task when language changes 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: language, 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, // enableAskUser: false, // promptForNextTask: false, // enablePanel: false, }) } const result = await win.pageAgent.execute(task) console.log(result) } return (
{/* Hero Section */}
{/* Background Pattern + Particles */}
GUI Agent in your webpage

{isZh ? '让你的 Web 应用' : 'The AI Operator'}
{isZh ? '拥有 AI 操作员' : 'Living in Your Web App'}

{isZh ? '🪄一行代码' : '🪄One line of code'} {isZh ? ',为你的网站添加 GUI Agent。' : ' adds intelligent GUI Agents to your website.'}
{isZh ? '用户/答疑机器人给出文字指示,AI 帮你操作页面。' : 'Users give natural language commands, AI handles the rest.'}

{/* Try It Now Section - Tab Card */}
{/* Tab Headers */}
{/* Tab Content */}
{activeTab === 'try' && (
setTask(e.target.value)} placeholder={ isZh ? '输入您想要 AI 执行的任务...' : 'Describe what you want AI to do...' } className="w-full px-4 py-3 pr-20 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none text-sm mb-0" data-page-agent-not-interactive />
)} {activeTab === 'other' && (
{/* 左侧:操作步骤 */}
{/* Keyboard Shortcut Hint */}

{isZh ? '步骤 1:' : 'Step 1:'} {' '} {isZh ? '显示收藏夹栏' : 'Show your bookmarks bar'}

Ctrl + Shift + B {isZh ? '或' : 'or'} ⌘ + Shift + B
{/* Draggable Bookmarklet */}

{isZh ? '步骤 2:' : 'Step 2:'} {' '} {isZh ? '拖拽下面按钮到收藏夹栏' : 'Drag this button to your bookmarks'}

{/* Usage Instructions */}

{isZh ? '步骤 3:' : 'Step 3:'} {' '} {isZh ? '在其他网站点击收藏夹中的按钮即可使用' : 'Click the bookmark on any site to activate'}

{/* 右侧:注意事项 */}

{isZh ? '⚠️ 注意' : '⚠️ Heads Up'}

  • {isZh ? '仅做技术评估,链接定期失效' : 'Demo only—link may expire without notice'}
  • {isZh ? '使用 DeepSeek 模型,参考 DeepSeek 用户协议和隐私政策' : 'This free demo uses DeepSeek API (see their terms and privacy policy)'}
  • {isZh ? '部分网站屏蔽了链接嵌入,将无反应' : 'Some sites block script injection (CSP policies)'}
  • {isZh ? '仅支持单页应用,页面跳转后需要重新注入' : 'Works on single-page apps only—reload required after navigation'}
  • {isZh ? '仅识别文本,不识别图像,不支持拖拽等复杂交互' : 'Text-only understanding—no image recognition or drag-and-drop'}
  • {isZh ? '详细使用限制参照' : 'Full limitations in'}{' '} {isZh ? '《文档》' : 'Docs'}
)}
  • {isZh ? '纯前端方案' : 'Pure Front-end Solution'}
  • {isZh ? '支持私有模型' : 'Your Own Models'}
  • {isZh ? '无痛脱敏' : 'Built-in Privacy'}
  • {isZh ? 'MIT 开源' : 'MIT Open Source'}
{/* Features Section */}
{/* Feature 1 */}

{isZh ? '纯页面内方案' : 'In-page Solution'}

{isZh ? '完全运行在你的页面内。不需要浏览器插件、不需要无头浏览器,不需要后端。' : 'Runs entirely within your page. No browser extensions, no headless browsers, and no backend required.'}

{/* Feature 2 */}

{isZh ? '零后端部署' : 'Zero Backend Setup'}

{isZh ? '前端脚本引入,自定义 LLM 接入点。从 OpenAI 到 qwen3,完全由你掌控。' : 'Just drop in a script. Works with any LLM provider—OpenAI, Anthropic, or your own models.'}

{/* Feature 3 */}

{isZh ? '普惠智能交互' : 'Natural Language UI'}

{isZh ? '为复杂 B端系统、管理后台提供自然语言入口。让每个用户都能轻松上手。' : 'Transform complex admin panels into chat interfaces. Make powerful tools accessible to everyone, not just experts.'}

{/* Feature 4 */}

{isZh ? '安全可控集成' : 'Secure by Design'}

{isZh ? '支持操作黑白名单、数据脱敏保护。注入自定义知识库,让 AI 按你的规则工作。' : 'Control what AI can access with allowlists, data masking, and custom knowledge injection. Your rules, your data.'}

{/* Use Cases Section */}
{isZh ? '应用场景' : 'Where It Shines'}

{isZh ? '从简单的表单填写到复杂的业务流程,AI 都能理解并执行' : 'From simple forms to complex workflows, AI understands and executes'}

{/* Use Case 1 */}

{isZh ? '对接答疑机器人' : 'Supercharge Support Bots'}

{isZh ? '把你的答疑助手变成全能Agent。客服机器人不再只说「请先点击设置按钮然后点击...」,而是直接帮用户现场操作。' : 'Stop telling users where to click—let AI do it for them. Turn your chatbot from a guide into an operator that actually completes tasks.'}

{/* Use Case 2 */}

{isZh ? '交互升级/智能化改造' : 'Modernize Legacy Apps'}

{isZh ? '一行代码,老应用变身Agent,产品专家帮用户操作复杂 B 端软件。降低人工支持成本,提高用户满意度。' : 'Add AI superpowers to old software without rebuilding. One script tag transforms complex enterprise tools into chat-driven interfaces.'}

{/* Use Case 3 */}

{isZh ? '产品教学' : 'Interactive Walkthroughs'}

{isZh ? '向用户演示交互过程,边做边教。例如让AI演示「如何提交报销申请」的完整操作流程。' : "Show, don't tell. Let AI demonstrate workflows in real-time—perfect for onboarding or training new users on complex systems."}

{/* Use Case 4 */}

{isZh ? '无障碍支持' : 'Accessibility First'}

{isZh ? '为视障用户、老年用户提供自然语言交互,对接屏幕阅读器或语音助理,让软件人人可用。' : 'Make web apps accessible through natural language. Perfect for screen readers, voice control, or users who find traditional interfaces challenging.'}

{/* One More Thing */}

One More Thing

{isZh ? '想要多页面控制?试试可选的浏览器扩展。' : 'Need multi-page control? Try the optional browser extension.'}

{'* '} {isZh ? 'PageAgent.js 本身无需任何扩展即可工作,扩展是额外的能力增强。' : 'PageAgent.js works without any extension — this is a power-up, not a dependency.'}

{isZh ? '多页面任务' : 'Multi-Page Tasks'}

{isZh ? '跨多个页面和标签页连续执行任务,不再受限于单页上下文' : 'Run tasks across multiple pages and tabs without being limited to a single page context'}

{isZh ? '页面内发起控制' : 'Control from Your Page'}

{isZh ? '在页面 JS 中发起任务,驱动整个浏览器完成跨标签操作' : 'Trigger tasks from page JS to drive the entire browser across tabs'}

{isZh ? '外部发起任务' : 'External Triggers'}

{isZh ? '页面 JS、本地 Agent 或云端 Agent 均可通过扩展发起任务' : 'Page JS, local agents, or cloud agents can trigger tasks through the extension'}

) }