diff --git a/packages/website/src/i18n/locales/en-US/common.ts b/packages/website/src/i18n/locales/en-US/common.ts index 8a3db3d..cdb8fc2 100644 --- a/packages/website/src/i18n/locales/en-US/common.ts +++ b/packages/website/src/i18n/locales/en-US/common.ts @@ -32,6 +32,7 @@ export default { custom_tools: 'Custom Tools', knowledge_injection: 'Instructions', data_masking: 'Data Masking', + chrome_extension: 'Chrome Extension', cdn_setup: 'CDN Setup', best_practices: 'Best Practices', third_party_agent: 'Third-party Agent', diff --git a/packages/website/src/i18n/locales/zh-CN/common.ts b/packages/website/src/i18n/locales/zh-CN/common.ts index e0df8e1..d796078 100644 --- a/packages/website/src/i18n/locales/zh-CN/common.ts +++ b/packages/website/src/i18n/locales/zh-CN/common.ts @@ -31,6 +31,7 @@ export default { custom_tools: '自定义工具', knowledge_injection: '知识注入', data_masking: '数据脱敏', + chrome_extension: 'Chrome 扩展', cdn_setup: 'CDN 引入', best_practices: '最佳实践', third_party_agent: '接入第三方 Agent', diff --git a/packages/website/src/pages/docs/Layout.tsx b/packages/website/src/pages/docs/Layout.tsx index 36d2e6a..ff21750 100644 --- a/packages/website/src/pages/docs/Layout.tsx +++ b/packages/website/src/pages/docs/Layout.tsx @@ -36,6 +36,7 @@ export default function DocsLayout({ children }: DocsLayoutProps) { { title: t('nav.custom_tools'), path: '/features/custom-tools' }, { title: t('nav.knowledge_injection'), path: '/features/custom-instructions' }, { title: t('nav.data_masking'), path: '/features/data-masking' }, + { title: '🧪 ' + t('nav.chrome_extension'), path: '/features/chrome-extension' }, ], }, { diff --git a/packages/website/src/pages/docs/features/chrome-extension/page.tsx b/packages/website/src/pages/docs/features/chrome-extension/page.tsx new file mode 100644 index 0000000..a4c7882 --- /dev/null +++ b/packages/website/src/pages/docs/features/chrome-extension/page.tsx @@ -0,0 +1,229 @@ +import { useTranslation } from 'react-i18next' + +import BetaNotice from '@/components/BetaNotice' +import CodeEditor from '@/components/CodeEditor' + +export default function ChromeExtension() { + const { i18n } = useTranslation() + const isZh = i18n.language === 'zh-CN' + + return ( +
+

{isZh ? 'Chrome 扩展' : 'Chrome Extension'}

+ +

+ {isZh + ? '可选的 Chrome 扩展,解锁多页任务和第三方 API 集成。' + : 'Optional Chrome extension that unlocks multi-page tasks and third-party API integration.'} +

+ + + +
+ {/* Hero Section */} +
+
+ 🌐 +
+

+ {isZh ? '轻量级 AI 浏览器' : 'Lightweight AI Browser'} +

+

+ {isZh + ? '解锁多页任务!借助 Chrome 扩展,Agent 可以跨标签页和页面导航,突破单页限制。' + : 'Unlock multi-page tasks! With the Chrome extension, your agent can navigate across tabs and pages, breaking the single-page limitation.'} +

+
+
+
+ + {/* Features */} +
+

{isZh ? '核心特性' : 'Key Features'}

+
+
+

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

+

+ {isZh + ? '跨多个页面和标签页执行任务,不再局限于单页操作。' + : 'Execute tasks across multiple pages and tabs. No longer limited to single-page operations.'} +

+
+
+

+ 🔌 {isZh ? '开放第三方接口' : 'Third-Party API'} +

+

+ {isZh + ? '用户授权后,你的网页、本地 Agent 或云端 Agent 都能通过扩展操作用户浏览器!' + : 'After user authorization, your webpage, local agent, or cloud agent can control the browser through the extension.'} +

+
+
+
+ + {/* Download */} +
+

{isZh ? '下载测试版' : 'Download Beta'}

+

+ {isZh + ? '扩展目前处于 Beta 阶段,请从 GitHub Releases 下载最新版本。' + : 'The extension is currently in beta. Download the latest version from GitHub Releases.'} +

+ + + + + {isZh ? '前往 GitHub Releases 下载' : 'Download from GitHub Releases'} + +
+ + {/* Third-party Integration */} +
+

+ {isZh ? '第三方接入' : 'Third-Party Integration'} +

+

+ {isZh + ? '用户授权后,外部应用可以调用扩展 API 来控制浏览器。' + : 'After user authorization, external applications can call the extension API to control the browser.'} +

+ + {/* Auth Flow */} +

{isZh ? '授权流程' : 'Authorization Flow'}

+

+ {isZh + ? '扩展使用基于 Token 的授权机制,扩展端和页面端必须持有匹配的 Token。' + : 'The extension uses a token-based authorization mechanism. Both extension and page must have matching tokens.'} +

+ + ')` + : `// 1. User installs extension and sets an auth token in extension settings +// 2. Your page reads the same token and stores it in localStorage +// 3. After token match, extension exposes window.execute() and window.dispose() + +// ⚠️ Check your extension popup for the auth token +localStorage.setItem('PageAgentExtUserAuthToken', '')` + } + language="javascript" + /> +
+ + {/* API Reference */} +
+

{isZh ? 'API 参考' : 'API Reference'}

+ +

window.execute(task, llmConfig)

+

+ {isZh + ? '使用 LLM 配置执行任务。返回一个 Promise,在任务完成时 resolve。' + : 'Execute a task with LLM configuration. Returns a Promise that resolves when the task completes.'} +

+ + + +

window.dispose()

+

+ {isZh + ? '停止当前正在运行的任务。停止后 Agent 可以重新使用。' + : 'Stop the current running task. The agent can be reused after disposal.'} +

+ + +
+ + {/* LLM Config */} +
+

{isZh ? 'LLM 配置' : 'LLM Configuration'}

+ + +
+ + {/* Security Notice */} +
+

+ ⚠️ {isZh ? '安全须知' : 'Security Notes'} +

+
    +
  • + •{' '} + {isZh + ? '用户必须在扩展设置中显式授权每个域名' + : 'Users must explicitly authorize each domain in extension settings'} +
  • +
  • + •{' '} + {isZh + ? '生产环境建议使用后端代理 LLM API Key' + : 'Consider using backend proxy for LLM API keys in production'} +
  • +
+
+
+
+ ) +} diff --git a/packages/website/src/pages/docs/index.tsx b/packages/website/src/pages/docs/index.tsx index d875ade..19a8296 100644 --- a/packages/website/src/pages/docs/index.tsx +++ b/packages/website/src/pages/docs/index.tsx @@ -6,8 +6,9 @@ import DocsLayout from './Layout' import PageAgentCoreDocs from './advanced/page-agent-core/page' // Advanced import PageAgentDocs from './advanced/page-agent/page' -import Instructions from './features/custom-instructions/page' // Features +import ChromeExtension from './features/chrome-extension/page' +import Instructions from './features/custom-instructions/page' import CustomTools from './features/custom-tools/page' import DataMasking from './features/data-masking/page' import Models from './features/models/page' @@ -73,6 +74,11 @@ export default function DocsRouter() { + + + + + {/* Integration */} diff --git a/packages/website/src/pages/docs/integration/best-practices/page.tsx b/packages/website/src/pages/docs/integration/best-practices/page.tsx index 37c28ea..10478f5 100644 --- a/packages/website/src/pages/docs/integration/best-practices/page.tsx +++ b/packages/website/src/pages/docs/integration/best-practices/page.tsx @@ -5,61 +5,10 @@ export default function BestPractices() { return (

最佳实践

- -

使用 page-agent 的最佳实践和常见问题解决方案。

- -

性能优化

- -
-
-

- ⚡ 减少 API 调用 -

-

- 合并多个操作指令,减少与 AI 模型的交互次数。 -

- - -
- -
-

- 🎯 精确的元素描述 -

-

- 使用具体、明确的元素描述,提高操作成功率。 -

-
-
- -

安全建议

- -
-
-

重要操作保护

-

对删除、支付等敏感操作设置黑名单保护。

-
- -
-

数据脱敏

-

启用数据脱敏功能,保护用户隐私信息。

-
-
- -

调试技巧

-
)