{isZh ? '纯页面内方案' : 'In-page Solution'}
{isZh ? '完全运行在你的页面内。不需要浏览器插件、不需要无头浏览器,不需要后端。' : 'Runs entirely within your page. No browser extensions, no headless browsers, and no backend required.'}
/* 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 (
{isZh
? '用户/答疑机器人给出文字指示,AI 帮你操作页面。'
: 'Users give natural language commands, AI handles the rest.'}
{isZh ? '步骤 1:' : 'Step 1:'} {' '} {isZh ? '显示收藏夹栏' : 'Show your bookmarks bar'}
{isZh ? '步骤 2:' : 'Step 2:'} {' '} {isZh ? '拖拽下面按钮到收藏夹栏' : 'Drag this button to your bookmarks'}
{isZh ? '步骤 3:' : 'Step 3:'} {' '} {isZh ? '在其他网站点击收藏夹中的按钮即可使用' : 'Click the bookmark on any site to activate'}
{isZh ? '完全运行在你的页面内。不需要浏览器插件、不需要无头浏览器,不需要后端。' : 'Runs entirely within your page. No browser extensions, no headless browsers, and no backend required.'}
{isZh ? '前端脚本引入,自定义 LLM 接入点。从 OpenAI 到 qwen3,完全由你掌控。' : 'Just drop in a script. Works with any LLM provider—OpenAI, Anthropic, or your own models.'}
{isZh ? '为复杂 B端系统、管理后台提供自然语言入口。让每个用户都能轻松上手。' : 'Transform complex admin panels into chat interfaces. Make powerful tools accessible to everyone, not just experts.'}
{isZh ? '支持操作黑白名单、数据脱敏保护。注入自定义知识库,让 AI 按你的规则工作。' : 'Control what AI can access with allowlists, data masking, and custom knowledge injection. Your rules, your data.'}
{isZh ? '从简单的表单填写到复杂的业务流程,AI 都能理解并执行' : 'From simple forms to complex workflows, AI understands and executes'}
{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.'}
{isZh ? '一行代码,老应用变身Agent,产品专家帮用户操作复杂 B 端软件。降低人工支持成本,提高用户满意度。' : 'Add AI superpowers to old software without rebuilding. One script tag transforms complex enterprise tools into chat-driven interfaces.'}
{isZh ? '向用户演示交互过程,边做边教。例如让AI演示「如何提交报销申请」的完整操作流程。' : "Show, don't tell. Let AI demonstrate workflows in real-time—perfect for onboarding or training new users on complex systems."}
{isZh ? '为视障用户、老年用户提供自然语言交互,对接屏幕阅读器或语音助理,让软件人人可用。' : 'Make web apps accessible through natural language. Perfect for screen readers, voice control, or users who find traditional interfaces challenging.'}
{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 ? '跨多个页面和标签页连续执行任务,不再受限于单页上下文' : 'Run tasks across multiple pages and tabs without being limited to a single page context'}
{isZh ? '在页面 JS 中发起任务,驱动整个浏览器完成跨标签操作' : 'Trigger tasks from page JS to drive the entire browser across tabs'}
{isZh ? '页面 JS、本地 Agent 或云端 Agent 均可通过扩展发起任务' : 'Page JS, local agents, or cloud agents can trigger tasks through the extension'}