diff --git a/pages/docs/features/custom-tools/page.tsx b/pages/docs/features/custom-tools/page.tsx index f526c60..38b18f0 100644 --- a/pages/docs/features/custom-tools/page.tsx +++ b/pages/docs/features/custom-tools/page.tsx @@ -6,8 +6,6 @@ export default function CustomTools() {

自定义工具

- -

通过注册自定义工具,扩展 AI Agent 的能力边界。使用 Zod 定义严格的输入接口,让 AI 安全调用你的业务逻辑。 @@ -21,92 +19,40 @@ export default function CustomTools() {

{ - // 执行业务逻辑 - const response = await fetch('/api/users', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(params) - }) - return await response.json() - } -})`} +// remove internal tool +const customTools = { + ask_user: null // never ask user questions +} + +const pageAgent = new PageAgent({customTools}) +`} language="javascript" /> -
-

属性详解

-
-
-

- 📝 name (必需) -

-

工具的唯一标识符,AI 通过此名称调用工具。

-
- name: 'searchProducts' // 驼峰命名,语义清晰 -
-
- -
-

- 💬 description (必需) -

-

详细描述工具功能,帮助 AI 理解使用场景。

-
- description: '根据关键词搜索商品,支持价格区间和分类筛选' -
-
- -
-

- 🔧 input (必需) -

-

Zod schema 定义输入参数的类型和验证规则。

-
- {`input: z.object({ - keyword: z.string().min(1), - priceRange: z.object({ - min: z.number().optional(), - max: z.number().optional() - }).optional() -})`} -
-
- -
-

- ⚡ execute (必需) -

-

异步函数,接收验证后的参数并执行具体逻辑。

-
- {`execute: async (params) => { - // params 已通过 Zod 验证 - const result = await businessLogic(params) - return result // 返回结果给 AI -}`} -
-
-
-
-

页面过滤器

+ + +

通过 pageFilter{' '} 属性控制工具在哪些页面可见,提升安全性和用户体验。 diff --git a/pages/docs/features/model-integration/page.tsx b/pages/docs/features/model-integration/page.tsx index 676b5bd..d5c82ef 100644 --- a/pages/docs/features/model-integration/page.tsx +++ b/pages/docs/features/model-integration/page.tsx @@ -6,8 +6,6 @@ export default function ModelIntegration() {

模型接入

- -

当前支持符合 OpenAI 接口规范且支持 tool call 的模型,包括公有云服务和私有部署方案。

diff --git a/pages/docs/introduction/quick-start/page.tsx b/pages/docs/introduction/quick-start/page.tsx index fc62609..836b0b7 100644 --- a/pages/docs/introduction/quick-start/page.tsx +++ b/pages/docs/introduction/quick-start/page.tsx @@ -6,8 +6,6 @@ export default function QuickStart() {

Quick Start

- -

几分钟内完成 page-agent 的集成。

安装步骤

diff --git a/src/config/index.ts b/src/config/index.ts index 06e39f1..9187afe 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -43,7 +43,7 @@ export interface UIConfig { * }), * execute: async function (this: PageAgent, input) { * const answer = await do_some_thing(input.question) - * return `✅ Received user answer: ${answer}` + (await getSystemInfo()) + * return `✅ Received user answer: ${answer}` * }, * }) * }