import { useTranslation } from 'react-i18next'
import CodeEditor from '@/components/CodeEditor'
export default function Configuration() {
const { i18n } = useTranslation()
const isZh = i18n.language === 'zh-CN'
return (
{isZh ? '配置选项' : 'Configuration'}
{isZh
? 'PageAgent 的完整配置接口定义。'
: 'Complete configuration interface for PageAgent.'}
{/* LLM Configuration */}
{isZh ? 'LLM 配置' : 'LLM Configuration'}
{isZh
? '配置与大语言模型的连接参数。'
: 'Configure connection parameters for the language model.'}
{/* Agent Configuration */}
{isZh ? 'Agent 配置' : 'Agent Configuration'}
{isZh
? '配置 Agent 的行为、生命周期钩子和扩展能力。'
: 'Configure agent behavior, lifecycle hooks, and extension capabilities.'}
/** Instructions to guide the agent's behavior */
instructions?: {
/** Global system-level instructions, applied to all tasks */
system?: string
/** Dynamic page-level instructions callback */
getPageInstructions?: (url: string) => string | undefined | null
}
// Lifecycle hooks (with \`this\` bound to PageAgent instance)
onBeforeStep?: (this: PageAgent, stepCnt: number) => Promise | void
onAfterStep?: (this: PageAgent, stepCnt: number, history: HistoryEvent[]) => Promise | void
onBeforeTask?: (this: PageAgent) => Promise | void
onAfterTask?: (this: PageAgent, result: ExecutionResult) => Promise | void
onDispose?: (this: PageAgent, reason?: string) => void
/**
* Transform page content before sending to LLM.
* Use cases: inspect extraction results, modify page info, mask sensitive data.
*/
transformPageContent?: (content: string) => Promise | string
/** @experimental Enable JavaScript execution tool */
experimentalScriptExecutionTool?: boolean
}`}
/>
{/* PageController Configuration */}
{isZh ? 'PageController 配置' : 'PageController Configuration'}
{isZh
? '配置 DOM 提取、元素交互和视觉高亮的细节。'
: 'Configure DOM extraction, element interaction, and visual highlighting.'}
Element))[]
/** Elements to force include for interaction */
interactiveWhitelist?: (Element | (() => Element))[]
/** Additional attributes to include in DOM extraction */
include_attributes?: string[]
/** Highlight overlay opacity (0-1) */
highlightOpacity?: number
/** Highlight label opacity (0-1) */
highlightLabelOpacity?: number
}
interface PageControllerConfig extends DomConfig {
/** Viewport expansion in pixels */
viewportExpansion?: number
/** Enable visual mask overlay during operations (default: false) */
enableMask?: boolean
}`}
/>
{/* Complete Type */}
{isZh ? '完整类型' : 'Complete Type'}
{/* Programmatic Usage Example */}
{isZh ? '程序化使用配置' : 'Programmatic Usage'}
{isZh
? '对于程序化集成场景,可以禁用 UI。'
: 'For programmatic integration, you can disable UI.'}
)
}