Skip to content

feat(tools): 集成 You.com 联网搜索工具 - #134

Open
tra371 wants to merge 1 commit into
BidingCC:masterfrom
Cooperation-org:feat/youcom-search
Open

feat(tools): 集成 You.com 联网搜索工具#134
tra371 wants to merge 1 commit into
BidingCC:masterfrom
Cooperation-org:feat/youcom-search

Conversation

@tra371

@tra371 tra371 commented Jul 26, 2026

Copy link
Copy Markdown

描述

为 BuildingAI 平台添加 You.com 联网搜索工具,供 AI 智能体在对话中实时检索网络信息。

改动内容

  • packages/@buildingai/ai-toolkit/src/tools/youcom-search.tools.ts:新增搜索工具文件,使用 Vercel ai SDK 的 tool() 函数和 zod schema 定义输入参数(query 必填,maxResults 可选 1-20,默认 10),内部调用 fetchJsonWithRetry 向 POST https://ydc-index.io/v1/search 发起请求,API Key 通过 YOUCOM_API_KEY 环境变量配置(可选),needsApproval 设为 false
  • packages/@buildingai/ai-toolkit/src/tools/index.ts:新增 youcom-search.tools.js 导出
  • packages/api/src/modules/ai/agents/services/agent-chat-completion.service.ts:在导入列表中加入 youcomSearch,在 buildTools() 方法中将 youcomSearch 注册到工具集合,在 skipApproval 集合中加入 "youcomSearch" 使其在启用审批流程时也无需确认即可执行

影响范围

  • 仅作为内置工具新增,不影响现有 MCP 集成、智能体逻辑或其他内置工具
  • 无需新增数据库表或配置项,YOUCOM_API_KEY 为可选环境变量

Add youcomSearch tool wrapping You.com Search API
(POST https://ydc-index.io/v1/search) following the
weather.tools.ts pattern with fetchJsonWithRetry and
optional YOUCOM_API_KEY env var. Registered in
AgentChatCompletionService.buildTools() with
needsApproval=false and added to skipApproval set.

- youcom-search.tools.ts: new tool using Vercel ai SDK
  tool() with zod schema (query, maxResults)
- index.ts: export new tool
- agent-chat-completion.service.ts: import, register,
  add to skipApproval set

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tra371

tra371 commented Jul 26, 2026

Copy link
Copy Markdown
Author

针对该问题的实现 - #133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant