feat(website): simplify heading api
This commit is contained in:
@@ -6,15 +6,18 @@ type Level = 2 | 3
|
|||||||
|
|
||||||
interface HeadingProps extends Omit<ComponentPropsWithoutRef<'h2'>, 'children'> {
|
interface HeadingProps extends Omit<ComponentPropsWithoutRef<'h2'>, 'children'> {
|
||||||
id: string
|
id: string
|
||||||
level: Level
|
level?: Level
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
const tags = { 2: 'h2', 3: 'h3' } as const
|
const levelStyles = {
|
||||||
|
2: { tag: 'h2', className: 'text-2xl font-semibold mb-4' },
|
||||||
|
3: { tag: 'h3', className: 'text-xl font-semibold mb-3' },
|
||||||
|
} as const
|
||||||
|
|
||||||
export function Heading({ id, level, className, children, ...props }: HeadingProps) {
|
export function Heading({ id, level = 2, className, children, ...props }: HeadingProps) {
|
||||||
const ref = useRef<HTMLHeadingElement>(null)
|
const ref = useRef<HTMLHeadingElement>(null)
|
||||||
const Tag = tags[level]
|
const { tag: Tag, className: defaultClassName } = levelStyles[level]
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (window.location.hash === `#${id}`) {
|
if (window.location.hash === `#${id}`) {
|
||||||
@@ -23,7 +26,12 @@ export function Heading({ id, level, className, children, ...props }: HeadingPro
|
|||||||
}, [id])
|
}, [id])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tag ref={ref} id={id} className={cn('group relative scroll-mt-20', className)} {...props}>
|
<Tag
|
||||||
|
ref={ref}
|
||||||
|
id={id}
|
||||||
|
className={cn('group relative scroll-mt-20', defaultClassName, className)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
<a
|
<a
|
||||||
href={`#${id}`}
|
href={`#${id}`}
|
||||||
className="absolute -left-5 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 text-gray-400 hover:text-blue-500 transition-opacity no-underline"
|
className="absolute -left-5 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 text-gray-400 hover:text-blue-500 transition-opacity no-underline"
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ export default function CustomUIDocs() {
|
|||||||
|
|
||||||
{/* Architecture */}
|
{/* Architecture */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="architecture" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="architecture">{isZh ? '架构' : 'Architecture'}</Heading>
|
||||||
{isZh ? '架构' : 'Architecture'}
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? 'PageAgent 由三个独立模块组成,可自由组合:'
|
? 'PageAgent 由三个独立模块组成,可自由组合:'
|
||||||
@@ -48,9 +46,7 @@ export default function CustomUIDocs() {
|
|||||||
|
|
||||||
{/* Two Event Streams */}
|
{/* Two Event Streams */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="two-event-streams" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="two-event-streams">{isZh ? '两个事件流' : 'Two Event Streams'}</Heading>
|
||||||
{isZh ? '两个事件流' : 'Two Event Streams'}
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? 'PageAgentCore 提供两种不同性质的事件流,方便 UI 渲染:'
|
? 'PageAgentCore 提供两种不同性质的事件流,方便 UI 渲染:'
|
||||||
@@ -125,9 +121,7 @@ export default function CustomUIDocs() {
|
|||||||
|
|
||||||
{/* All Events */}
|
{/* All Events */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="all-events" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="all-events">{isZh ? '所有事件' : 'All Events'}</Heading>
|
||||||
{isZh ? '所有事件' : 'All Events'}
|
|
||||||
</Heading>
|
|
||||||
<APIReference
|
<APIReference
|
||||||
properties={[
|
properties={[
|
||||||
{
|
{
|
||||||
@@ -162,9 +156,7 @@ export default function CustomUIDocs() {
|
|||||||
|
|
||||||
{/* HistoricalEvent Types */}
|
{/* HistoricalEvent Types */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="historicalevent" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="historicalevent">HistoricalEvent</Heading>
|
||||||
HistoricalEvent
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh ? 'agent.history 数组中的事件类型:' : 'Event types in agent.history array:'}
|
{isZh ? 'agent.history 数组中的事件类型:' : 'Event types in agent.history array:'}
|
||||||
</p>
|
</p>
|
||||||
@@ -181,9 +173,7 @@ export default function CustomUIDocs() {
|
|||||||
|
|
||||||
{/* AgentActivity Types */}
|
{/* AgentActivity Types */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="agentactivity" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="agentactivity">AgentActivity</Heading>
|
||||||
AgentActivity
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh ? 'activity 事件的 detail 类型:' : 'The detail type of activity events:'}
|
{isZh ? 'activity 事件的 detail 类型:' : 'The detail type of activity events:'}
|
||||||
</p>
|
</p>
|
||||||
@@ -202,9 +192,7 @@ export default function CustomUIDocs() {
|
|||||||
|
|
||||||
{/* React Hooks Example */}
|
{/* React Hooks Example */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="using-react-hooks" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="using-react-hooks">{isZh ? '使用 React Hooks' : 'Using React Hooks'}</Heading>
|
||||||
{isZh ? '使用 React Hooks' : 'Using React Hooks'}
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh ? '监听事件并更新 React 状态:' : 'Listen to events and update React state:'}
|
{isZh ? '监听事件并更新 React 状态:' : 'Listen to events and update React state:'}
|
||||||
</p>
|
</p>
|
||||||
@@ -240,11 +228,7 @@ export default function CustomUIDocs() {
|
|||||||
|
|
||||||
{/* Assembly Example */}
|
{/* Assembly Example */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading
|
<Heading id="assembling-core-controller-custom-ui">
|
||||||
id="assembling-core-controller-custom-ui"
|
|
||||||
level={2}
|
|
||||||
className="text-2xl font-semibold mb-4"
|
|
||||||
>
|
|
||||||
{isZh ? '组装 Core + Controller + 自定义 UI' : 'Assembling Core + Controller + Custom UI'}
|
{isZh ? '组装 Core + Controller + 自定义 UI' : 'Assembling Core + Controller + Custom UI'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function PageAgentCoreDocs() {
|
|||||||
|
|
||||||
{/* When to use */}
|
{/* When to use */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="when-to-use-pageagentcore" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="when-to-use-pageagentcore">
|
||||||
{isZh ? '何时使用 PageAgentCore' : 'When to Use PageAgentCore'}
|
{isZh ? '何时使用 PageAgentCore' : 'When to Use PageAgentCore'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<ul className="list-disc list-inside text-gray-600 dark:text-gray-400 space-y-2">
|
<ul className="list-disc list-inside text-gray-600 dark:text-gray-400 space-y-2">
|
||||||
@@ -39,9 +39,7 @@ export default function PageAgentCoreDocs() {
|
|||||||
|
|
||||||
{/* Basic Usage */}
|
{/* Basic Usage */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="basic-usage" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="basic-usage">{isZh ? '基本用法' : 'Basic Usage'}</Heading>
|
||||||
{isZh ? '基本用法' : 'Basic Usage'}
|
|
||||||
</Heading>
|
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
language="typescript"
|
language="typescript"
|
||||||
code={`import { PageAgentCore } from '@page-agent/core'
|
code={`import { PageAgentCore } from '@page-agent/core'
|
||||||
@@ -79,9 +77,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* LLM Configuration */}
|
{/* LLM Configuration */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="llmconfig" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="llmconfig">LLMConfig</Heading>
|
||||||
LLMConfig
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? '配置与大语言模型的连接参数。支持 OpenAI 兼容的 API。'
|
? '配置与大语言模型的连接参数。支持 OpenAI 兼容的 API。'
|
||||||
@@ -138,9 +134,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* Agent Configuration */}
|
{/* Agent Configuration */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="agentconfig" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="agentconfig">AgentConfig</Heading>
|
||||||
AgentConfig
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? '配置 Agent 的行为、生命周期钩子和扩展能力。'
|
? '配置 Agent 的行为、生命周期钩子和扩展能力。'
|
||||||
@@ -217,9 +211,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* Lifecycle Hooks */}
|
{/* Lifecycle Hooks */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="lifecycle-hooks" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="lifecycle-hooks">{isZh ? '生命周期钩子' : 'Lifecycle Hooks'}</Heading>
|
||||||
{isZh ? '生命周期钩子' : 'Lifecycle Hooks'}
|
|
||||||
</Heading>
|
|
||||||
<div className="bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4 mb-4">
|
<div className="bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4 mb-4">
|
||||||
<p className="text-amber-800 dark:text-amber-200 text-sm">
|
<p className="text-amber-800 dark:text-amber-200 text-sm">
|
||||||
<strong>⚠️ {isZh ? '警告' : 'Warning'}:</strong>{' '}
|
<strong>⚠️ {isZh ? '警告' : 'Warning'}:</strong>{' '}
|
||||||
@@ -271,9 +263,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* PageController Configuration */}
|
{/* PageController Configuration */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="pagecontrollerconfig" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="pagecontrollerconfig">PageControllerConfig</Heading>
|
||||||
PageControllerConfig
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? '配置 DOM 提取、元素交互和视觉反馈。'
|
? '配置 DOM 提取、元素交互和视觉反馈。'
|
||||||
@@ -332,9 +322,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* Properties */}
|
{/* Properties */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="properties" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="properties">{isZh ? '属性' : 'Properties'}</Heading>
|
||||||
{isZh ? '属性' : 'Properties'}
|
|
||||||
</Heading>
|
|
||||||
<APIReference
|
<APIReference
|
||||||
properties={[
|
properties={[
|
||||||
{
|
{
|
||||||
@@ -379,9 +367,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* Methods */}
|
{/* Methods */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="methods" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="methods">{isZh ? '方法' : 'Methods'}</Heading>
|
||||||
{isZh ? '方法' : 'Methods'}
|
|
||||||
</Heading>
|
|
||||||
<APIReference
|
<APIReference
|
||||||
properties={[
|
properties={[
|
||||||
{
|
{
|
||||||
@@ -404,9 +390,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* Events */}
|
{/* Events */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="events" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="events">{isZh ? '事件' : 'Events'}</Heading>
|
||||||
{isZh ? '事件' : 'Events'}
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh ? (
|
{isZh ? (
|
||||||
<>
|
<>
|
||||||
@@ -455,9 +439,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* ExecutionResult */}
|
{/* ExecutionResult */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="executionresult" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="executionresult">ExecutionResult</Heading>
|
||||||
ExecutionResult
|
|
||||||
</Heading>
|
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
language="typescript"
|
language="typescript"
|
||||||
code={`interface ExecutionResult {
|
code={`interface ExecutionResult {
|
||||||
@@ -473,9 +455,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* AgentActivity */}
|
{/* AgentActivity */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="agentactivity" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="agentactivity">AgentActivity</Heading>
|
||||||
AgentActivity
|
|
||||||
</Heading>
|
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
language="typescript"
|
language="typescript"
|
||||||
code={`type AgentActivity =
|
code={`type AgentActivity =
|
||||||
@@ -491,9 +471,7 @@ const result = await agent.execute('Fill in the form with test data')`}
|
|||||||
|
|
||||||
{/* Headless Usage */}
|
{/* Headless Usage */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="headless-mode" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="headless-mode">{isZh ? '无头模式' : 'Headless Mode'}</Heading>
|
||||||
{isZh ? '无头模式' : 'Headless Mode'}
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? '在非 DOM 环境中,你必须实现自定义的 PageController(例如远程操作页面或 Puppeteer)。'
|
? '在非 DOM 环境中,你必须实现自定义的 PageController(例如远程操作页面或 Puppeteer)。'
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default function PageAgentDocs() {
|
|||||||
|
|
||||||
{/* When to use */}
|
{/* When to use */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="when-to-use-pageagent" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="when-to-use-pageagent">
|
||||||
{isZh ? '何时使用 PageAgent' : 'When to Use PageAgent'}
|
{isZh ? '何时使用 PageAgent' : 'When to Use PageAgent'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
@@ -44,9 +44,7 @@ export default function PageAgentDocs() {
|
|||||||
|
|
||||||
{/* Basic Usage */}
|
{/* Basic Usage */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="basic-usage" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="basic-usage">{isZh ? '基本用法' : 'Basic Usage'}</Heading>
|
||||||
{isZh ? '基本用法' : 'Basic Usage'}
|
|
||||||
</Heading>
|
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
language="typescript"
|
language="typescript"
|
||||||
code={`import { PageAgent } from 'page-agent'
|
code={`import { PageAgent } from 'page-agent'
|
||||||
@@ -72,9 +70,7 @@ console.log(result.history) // Full execution history`}
|
|||||||
|
|
||||||
{/* Class Definition */}
|
{/* Class Definition */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="class-definition" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="class-definition">{isZh ? '类定义' : 'Class Definition'}</Heading>
|
||||||
{isZh ? '类定义' : 'Class Definition'}
|
|
||||||
</Heading>
|
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
language="typescript"
|
language="typescript"
|
||||||
code={`class PageAgent extends PageAgentCore {
|
code={`class PageAgent extends PageAgentCore {
|
||||||
@@ -114,9 +110,7 @@ console.log(result.history) // Full execution history`}
|
|||||||
|
|
||||||
{/* Configuration */}
|
{/* Configuration */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="configuration" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="configuration">{isZh ? '配置' : 'Configuration'}</Heading>
|
||||||
{isZh ? '配置' : 'Configuration'}
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? 'PageAgent 使用与 PageAgentCore 相同的配置接口。'
|
? 'PageAgent 使用与 PageAgentCore 相同的配置接口。'
|
||||||
@@ -151,9 +145,7 @@ console.log(result.history) // Full execution history`}
|
|||||||
|
|
||||||
{/* Panel Property */}
|
{/* Panel Property */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="panel-property" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="panel-property">{isZh ? 'Panel 属性' : 'Panel Property'}</Heading>
|
||||||
{isZh ? 'Panel 属性' : 'Panel Property'}
|
|
||||||
</Heading>
|
|
||||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? 'PageAgent 自动创建一个 Panel 实例。你可以通过 panel 属性访问它来控制 UI:'
|
? 'PageAgent 自动创建一个 Panel 实例。你可以通过 panel 属性访问它来控制 UI:'
|
||||||
@@ -194,7 +186,7 @@ agent.panel.dispose()`}
|
|||||||
|
|
||||||
{/* Comparison with PageAgentCore */}
|
{/* Comparison with PageAgentCore */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="pageagent-vs-pageagentcore" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="pageagent-vs-pageagentcore">
|
||||||
{isZh ? 'PageAgent vs PageAgentCore' : 'PageAgent vs PageAgentCore'}
|
{isZh ? 'PageAgent vs PageAgentCore' : 'PageAgent vs PageAgentCore'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700">
|
<div className="overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700">
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function ChromeExtension() {
|
|||||||
<div className="space-y-8 mt-8">
|
<div className="space-y-8 mt-8">
|
||||||
{/* Features */}
|
{/* Features */}
|
||||||
<section>
|
<section>
|
||||||
<Heading id="key-features" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="key-features" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '核心特性' : 'Key Features'}
|
{isZh ? '核心特性' : 'Key Features'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="grid md:grid-cols-3 gap-4">
|
<div className="grid md:grid-cols-3 gap-4">
|
||||||
@@ -60,7 +60,7 @@ export default function ChromeExtension() {
|
|||||||
|
|
||||||
{/* Install */}
|
{/* Install */}
|
||||||
<section>
|
<section>
|
||||||
<Heading id="get-the-extension" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="get-the-extension" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '获取扩展' : 'Get the Extension'}
|
{isZh ? '获取扩展' : 'Get the Extension'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="flex flex-wrap gap-3">
|
<div className="flex flex-wrap gap-3">
|
||||||
@@ -91,11 +91,7 @@ export default function ChromeExtension() {
|
|||||||
|
|
||||||
{/* Relationship with PageAgent.js */}
|
{/* Relationship with PageAgent.js */}
|
||||||
<section>
|
<section>
|
||||||
<Heading
|
<Heading id="how-it-relates-to-page-agent-js" className="text-2xl font-bold mb-4">
|
||||||
id="how-it-relates-to-page-agent-js"
|
|
||||||
level={2}
|
|
||||||
className="text-2xl font-bold mb-4"
|
|
||||||
>
|
|
||||||
{isZh ? '与 PageAgent.js 的关系' : 'How It Relates to PageAgent.js'}
|
{isZh ? '与 PageAgent.js 的关系' : 'How It Relates to PageAgent.js'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="p-5 bg-gray-50 dark:bg-gray-800 rounded-lg space-y-3 text-gray-600 dark:text-gray-300">
|
<div className="p-5 bg-gray-50 dark:bg-gray-800 rounded-lg space-y-3 text-gray-600 dark:text-gray-300">
|
||||||
@@ -114,7 +110,7 @@ export default function ChromeExtension() {
|
|||||||
|
|
||||||
{/* Third-party Integration */}
|
{/* Third-party Integration */}
|
||||||
<section>
|
<section>
|
||||||
<Heading id="third-party-integration" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="third-party-integration" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '第三方接入' : 'Third-Party Integration'}
|
{isZh ? '第三方接入' : 'Third-Party Integration'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
||||||
@@ -154,7 +150,7 @@ localStorage.setItem('PageAgentExtUserAuthToken', '<your-token-from-extension>')
|
|||||||
|
|
||||||
{/* API Reference */}
|
{/* API Reference */}
|
||||||
<section>
|
<section>
|
||||||
<Heading id="api-reference" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="api-reference" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? 'API 参考' : 'API Reference'}
|
{isZh ? 'API 参考' : 'API Reference'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -181,7 +177,7 @@ localStorage.setItem('PageAgentExtUserAuthToken', '<your-token-from-extension>')
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/* TypeScript Declaration */}
|
{/* TypeScript Declaration */}
|
||||||
<Heading id="typescript-declaration" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="typescript-declaration" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? 'TypeScript 类型声明' : 'TypeScript Declaration'}
|
{isZh ? 'TypeScript 类型声明' : 'TypeScript Declaration'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
||||||
@@ -317,7 +313,6 @@ window.PAGE_AGENT_EXT.stop()`
|
|||||||
<section>
|
<section>
|
||||||
<Heading
|
<Heading
|
||||||
id="integrate-multipageagent-into-your-extension"
|
id="integrate-multipageagent-into-your-extension"
|
||||||
level={2}
|
|
||||||
className="text-2xl font-bold mb-4"
|
className="text-2xl font-bold mb-4"
|
||||||
>
|
>
|
||||||
{isZh
|
{isZh
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default function Instructions() {
|
|||||||
|
|
||||||
{/* System Instructions */}
|
{/* System Instructions */}
|
||||||
<section className="mb-12">
|
<section className="mb-12">
|
||||||
<Heading id="system-instructions" level={2} className="text-3xl font-bold mb-6">
|
<Heading id="system-instructions" className="text-3xl font-bold mb-6">
|
||||||
{isZh ? '系统级指导 (System Instructions)' : 'System Instructions'}
|
{isZh ? '系统级指导 (System Instructions)' : 'System Instructions'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ Guidelines:
|
|||||||
|
|
||||||
{/* Page Instructions */}
|
{/* Page Instructions */}
|
||||||
<section className="mb-12">
|
<section className="mb-12">
|
||||||
<Heading id="page-instructions" level={2} className="text-3xl font-bold mb-6">
|
<Heading id="page-instructions" className="text-3xl font-bold mb-6">
|
||||||
{isZh ? '页面级指导 (Page Instructions)' : 'Page Instructions'}
|
{isZh ? '页面级指导 (Page Instructions)' : 'Page Instructions'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ This is the product listing page.
|
|||||||
|
|
||||||
{/* How It Works */}
|
{/* How It Works */}
|
||||||
<section className="mb-12">
|
<section className="mb-12">
|
||||||
<Heading id="how-it-works" level={2} className="text-3xl font-bold mb-6">
|
<Heading id="how-it-works" className="text-3xl font-bold mb-6">
|
||||||
{isZh ? '工作原理' : 'How It Works'}
|
{isZh ? '工作原理' : 'How It Works'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function CustomTools() {
|
|||||||
|
|
||||||
<div className="space-y-8">
|
<div className="space-y-8">
|
||||||
<section>
|
<section>
|
||||||
<Heading id="tool-registration" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="tool-registration" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '工具注册' : 'Tool Registration'}
|
{isZh ? '工具注册' : 'Tool Registration'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
||||||
@@ -58,7 +58,7 @@ const pageAgent = new PageAgent({customTools})
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<Heading id="page-filter" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="page-filter" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '页面过滤器' : 'Page Filter'}
|
{isZh ? '页面过滤器' : 'Page Filter'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ const pageAgent = new PageAgent({customTools})
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<Heading id="best-practices" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="best-practices" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '最佳实践' : 'Best Practices'}
|
{isZh ? '最佳实践' : 'Best Practices'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default function DataMasking() {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<section className="mb-12">
|
<section className="mb-12">
|
||||||
<Heading id="api-definition" level={2} className="text-3xl font-bold mb-6">
|
<Heading id="api-definition" className="text-3xl font-bold mb-6">
|
||||||
{isZh ? '接口定义' : 'API Definition'}
|
{isZh ? '接口定义' : 'API Definition'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ export default function DataMasking() {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="mb-12">
|
<section className="mb-12">
|
||||||
<Heading id="common-masking-patterns" level={2} className="text-3xl font-bold mb-6">
|
<Heading id="common-masking-patterns" className="text-3xl font-bold mb-6">
|
||||||
{isZh ? '常用脱敏规则' : 'Common Masking Patterns'}
|
{isZh ? '常用脱敏规则' : 'Common Masking Patterns'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export default function Models() {
|
|||||||
|
|
||||||
{/* Models Section */}
|
{/* Models Section */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="tested-models" level={2} className="text-2xl font-semibold mb-3">
|
<Heading id="tested-models" className="text-2xl font-semibold mb-3">
|
||||||
{isZh ? '已测试模型' : 'Tested Models'}
|
{isZh ? '已测试模型' : 'Tested Models'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<p className="text-sm text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-sm text-gray-600 dark:text-gray-400 mb-4">
|
||||||
@@ -144,9 +144,7 @@ export default function Models() {
|
|||||||
|
|
||||||
{/* Configuration Section */}
|
{/* Configuration Section */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="configuration" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="configuration">{isZh ? '配置方式' : 'Configuration'}</Heading>
|
||||||
{isZh ? '配置方式' : 'Configuration'}
|
|
||||||
</Heading>
|
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
code={`// OpenAI-compatible services (e.g., Alibaba Bailian)
|
code={`// OpenAI-compatible services (e.g., Alibaba Bailian)
|
||||||
const pageAgent = new PageAgent({
|
const pageAgent = new PageAgent({
|
||||||
@@ -168,9 +166,7 @@ const pageAgent = new PageAgent({
|
|||||||
|
|
||||||
{/* Free Testing API Section */}
|
{/* Free Testing API Section */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="free-testing-api" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="free-testing-api">{isZh ? '免费测试接口' : 'Free Testing API'}</Heading>
|
||||||
{isZh ? '免费测试接口' : 'Free Testing API'}
|
|
||||||
</Heading>
|
|
||||||
<p className="text-sm text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-sm text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? '以下免费测试接口仅供 PageAgent.js 和 PageAgent Extension 的技术评估使用。有速率限制,可能随时变更。请勿用于生产环境。'
|
? '以下免费测试接口仅供 PageAgent.js 和 PageAgent Extension 的技术评估使用。有速率限制,可能随时变更。请勿用于生产环境。'
|
||||||
@@ -220,9 +216,7 @@ LLM_API_KEY="NA"`}
|
|||||||
|
|
||||||
{/* Ollama Section */}
|
{/* Ollama Section */}
|
||||||
<section className="mb-10">
|
<section className="mb-10">
|
||||||
<Heading id="ollama" level={2} className="text-2xl font-semibold mb-4">
|
<Heading id="ollama">Ollama</Heading>
|
||||||
Ollama
|
|
||||||
</Heading>
|
|
||||||
<p className="text-sm text-gray-600 dark:text-gray-400 mb-4">
|
<p className="text-sm text-gray-600 dark:text-gray-400 mb-4">
|
||||||
{isZh
|
{isZh
|
||||||
? '已在 Ollama 0.15 + qwen3:14b (RTX3090 24GB) 上测试通过。'
|
? '已在 Ollama 0.15 + qwen3:14b (RTX3090 24GB) 上测试通过。'
|
||||||
|
|||||||
@@ -19,11 +19,7 @@ export default function SecurityPermissions() {
|
|||||||
|
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<section>
|
<section>
|
||||||
<Heading
|
<Heading id="element-interaction-allowlist-blocklist" className="text-2xl font-bold mb-3">
|
||||||
id="element-interaction-allowlist-blocklist"
|
|
||||||
level={2}
|
|
||||||
className="text-2xl font-bold mb-3"
|
|
||||||
>
|
|
||||||
{isZh ? '元素操作黑白名单' : 'Element Interaction Allowlist/Blocklist'}
|
{isZh ? '元素操作黑白名单' : 'Element Interaction Allowlist/Blocklist'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
@@ -51,11 +47,7 @@ export default function SecurityPermissions() {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<Heading
|
<Heading id="instruction-safety-constraints" className="text-2xl font-bold mb-3">
|
||||||
id="instruction-safety-constraints"
|
|
||||||
level={2}
|
|
||||||
className="text-2xl font-bold mb-3"
|
|
||||||
>
|
|
||||||
{isZh ? 'Instruction 安全约束' : 'Instruction Safety Constraints'}
|
{isZh ? 'Instruction 安全约束' : 'Instruction Safety Constraints'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg">
|
<div className="p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function ThirdPartyAgentPage() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Heading id="integration-method" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="integration-method" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '集成方式' : 'Integration Method'}
|
{isZh ? '集成方式' : 'Integration Method'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ const pageAgentTool = {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Heading id="use-cases" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="use-cases" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '应用场景' : 'Use Cases'}
|
{isZh ? '应用场景' : 'Use Cases'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="grid md:grid-cols-2 gap-4 mb-6">
|
<div className="grid md:grid-cols-2 gap-4 mb-6">
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function LimitationsPage() {
|
|||||||
|
|
||||||
<div className="prose prose-lg dark:prose-invert max-w-none">
|
<div className="prose prose-lg dark:prose-invert max-w-none">
|
||||||
{/* PageAgent.js vs PageAgentExt */}
|
{/* PageAgent.js vs PageAgentExt */}
|
||||||
<Heading id="pageagent-js-vs-pageagentext" level={2} className="text-2xl font-bold mb-3">
|
<Heading id="pageagent-js-vs-pageagentext" className="text-2xl font-bold mb-3">
|
||||||
{isZh ? 'PageAgent.js vs PageAgentExt' : 'PageAgent.js vs PageAgentExt'}
|
{isZh ? 'PageAgent.js vs PageAgentExt' : 'PageAgent.js vs PageAgentExt'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
<p className="text-gray-600 dark:text-gray-300 mb-4">
|
||||||
@@ -83,7 +83,7 @@ export default function LimitationsPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Interaction Limitations */}
|
{/* Interaction Limitations */}
|
||||||
<Heading id="interaction-capabilities" level={2} className="text-2xl font-bold mb-3">
|
<Heading id="interaction-capabilities" className="text-2xl font-bold mb-3">
|
||||||
{isZh ? '交互能力' : 'Interaction Capabilities'}
|
{isZh ? '交互能力' : 'Interaction Capabilities'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="bg-gray-50 dark:bg-gray-800 rounded-lg p-6 mb-6">
|
<div className="bg-gray-50 dark:bg-gray-800 rounded-lg p-6 mb-6">
|
||||||
@@ -128,7 +128,7 @@ export default function LimitationsPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Understanding Limitations */}
|
{/* Understanding Limitations */}
|
||||||
<Heading id="understanding" level={2} className="text-2xl font-bold mb-3">
|
<Heading id="understanding" className="text-2xl font-bold mb-3">
|
||||||
{isZh ? '理解能力' : 'Understanding'}
|
{isZh ? '理解能力' : 'Understanding'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="bg-amber-50 dark:bg-amber-900/20 border-l-4 border-amber-400 p-4 mb-6">
|
<div className="bg-amber-50 dark:bg-amber-900/20 border-l-4 border-amber-400 p-4 mb-6">
|
||||||
@@ -145,7 +145,7 @@ export default function LimitationsPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Website Quality */}
|
{/* Website Quality */}
|
||||||
<Heading id="page-quality-matters" level={2} className="text-2xl font-bold mb-3">
|
<Heading id="page-quality-matters" className="text-2xl font-bold mb-3">
|
||||||
{isZh ? '网页质量影响' : 'Page Quality Matters'}
|
{isZh ? '网页质量影响' : 'Page Quality Matters'}
|
||||||
</Heading>
|
</Heading>
|
||||||
<div className="bg-gray-50 dark:bg-gray-800 rounded-lg p-6">
|
<div className="bg-gray-50 dark:bg-gray-800 rounded-lg p-6">
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export default function Overview() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<Heading id="what-is-page-agent" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="what-is-page-agent" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '什么是 page-agent?' : 'What is page-agent?'}
|
{isZh ? '什么是 page-agent?' : 'What is page-agent?'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ export default function Overview() {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<Heading id="core-features" level={2} className="text-2xl font-bold mb-3">
|
<Heading id="core-features" className="text-2xl font-bold mb-3">
|
||||||
{isZh ? '核心特性' : 'Core Features'}
|
{isZh ? '核心特性' : 'Core Features'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ export default function Overview() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Heading id="vs-browser-use" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="vs-browser-use" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '与 browser-use 的区别' : 'vs. browser-use'}
|
{isZh ? '与 browser-use 的区别' : 'vs. browser-use'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ export default function Overview() {
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Heading id="use-cases" level={2} className="text-2xl font-bold mb-4">
|
<Heading id="use-cases" className="text-2xl font-bold mb-4">
|
||||||
{isZh ? '应用场景' : 'Use Cases'}
|
{isZh ? '应用场景' : 'Use Cases'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default function QuickStart() {
|
|||||||
{isZh ? '几分钟内完成 page-agent 的集成。' : 'Integrate page-agent in minutes.'}
|
{isZh ? '几分钟内完成 page-agent 的集成。' : 'Integrate page-agent in minutes.'}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<Heading id="installation-steps" level={2} className="text-2xl font-bold mb-3">
|
<Heading id="installation-steps" className="text-2xl font-bold mb-3">
|
||||||
{isZh ? '安装步骤' : 'Installation Steps'}
|
{isZh ? '安装步骤' : 'Installation Steps'}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
|
|||||||
@@ -373,7 +373,6 @@ export default function TroubleshootingPage() {
|
|||||||
<section key={section.id} className="scroll-mt-24">
|
<section key={section.id} className="scroll-mt-24">
|
||||||
<Heading
|
<Heading
|
||||||
id={section.id}
|
id={section.id}
|
||||||
level={2}
|
|
||||||
className="text-2xl font-bold mb-4 text-gray-900 dark:text-white"
|
className="text-2xl font-bold mb-4 text-gray-900 dark:text-white"
|
||||||
>
|
>
|
||||||
{isZh ? section.title.zh : section.title.en}
|
{isZh ? section.title.zh : section.title.en}
|
||||||
|
|||||||
Reference in New Issue
Block a user