当前位置: 首页 > Skill >

Bocha Web Search

Bocha Web Search

Bocha Web Search

博查网络搜索工具,基于 Bocha Web Search API,用于在线查询、事实核查、获取最新信息并提供引用。

1.0.2 2026.11.22 746
获取Skill文件查看使用说明
作 者:苏辰 许可证: 更新时间:2026.11.22
本文目录展开

Bocha Web Search

本 Skill 使用 Bocha Web Search API 进行联网搜索。

This Skill performs web searches using the Bocha Web Search API.

它的主要设计目标是:

It is designed to:

  • 检索最新、最及时的信息 Retrieve up-to-date information
  • 核实事实声明 Verify factual claims
  • 提供基于可靠来源的回答 Provide source-backed answers
  • 支持带有引用的回复 Support citation-based responses

此版本避免了特定于 shell 的指令和系统级文件操作,以确保与 ClawHub 等安全环境的兼容性。

This version avoids shell-specific instructions and system-level file operations to ensure compatibility with secure environments such as ClawHub.

何时使用此 Skill (When to Use This Skill)

当用户的请求出现以下情况时,请使用此 Skill:

Use this skill whenever the user request:

  • 需要对话历史中不存在的信息 Requires information not present in the conversation
  • 涉及具有时效性或不断变化的数据,如新闻、政策、财务数据、发布信息等 Involves time-sensitive or changing data
  • 需要进行事实核查或验证 Requires fact-checking or verification
  • 要求提供链接、信息来源或引用 Requests links, sources, or citations
  • 提及特定的组织、事件、人物或产品,并询问具体的事实细节 Mentions a specific organization, event, person, or product and asks for factual details

如果不确定是否需要进行在线查询,请直接执行搜索。

If uncertain whether online lookup is required, perform a search.

API 规范 (API Specification)

请求端点 (Endpoint):

POST https://api.bocha.cn/v1/web-search

请求头 (Headers):

Authorization: Bearer <BOCHA_API_KEY>
Content-Type: application/json

请求体参数 (Request Body):

参数名 类型 必填 说明 Description
query string 是 搜索关键词 Search query string
freshness string 否 时间范围,可选值:noLimit(默认), oneDay, oneWeek, oneMonth, oneYear Time filter
summary boolean 否 是否返回网页原文摘要,默认 true Whether to include web original content
count integer 否 返回结果数量,默认 10,最大 50 Number of returned results

工作流程 (Workflow)

第一步:提取搜索参数 (Step 1: Extract Search Parameters)

从用户请求中提取搜索关键词和相关参数:

Extract search keywords and related parameters from the user's request:

  1. query: 从用户问题中提取核心搜索词,需要保留“最近”、“今年”、“今年1月”等时间范围描述。 Extract core search terms from the user's question, preserving time range descriptions like "recently", "this year", "January this year", etc.
  2. freshness: 根据用户描述的时间范围确定,默认选择 noLimit,以便 web-search 结合 query 中的时间范围描述自动改写最合适的 freshness 值。 Determine based on the user's described time range, defaulting to noLimit so web-search can automatically rewrite the most appropriate freshness value.
  3. summary: 默认 true。 Default is true.
  4. count: 默认 10,如用户明确要求更多结果则进行调整。 Default is 10, adjust if the user explicitly requests more results.

第二步:发起资源请求 (Step 2: Send API Request)

向博查 API 发起 POST 请求:

Send a POST request to the Bocha API:

{
  "query": "<USER_QUERY>",
  "freshness": "noLimit",
  "summary": true,
  "count": 10
}

响应结构 (Response Structure)

搜索结果位于以下路径:

Search results are located at:

data.webPages.value[]

每个结果通常包含以下字段:

Each result typically contains:

  • name (标题 / Title)
  • url (链接 / URL)
  • snippet (内容片段 / Snippet)
  • summary (原始内容摘要 / Summary)
  • siteName (站点名称 / Site Name)
  • datePublished (发布日期 / Date Published)

引用规则 (Citation Rules - Mandatory)

在生成最终回答时,必须遵守以下规则:

When generating the final answer, you must adhere to the following rules:

  1. 使用返回的来源来支撑你的事实性陈述。 Support factual statements using returned sources.
  2. 按出现顺序分配引用编号:[1], [2], [3] Assign citation numbers in order of appearance.
  3. 在回答的末尾添加“参考资料”部分。 End with a "References" section.
  4. 每个参考文献必须包含标题、链接和站点名称(如果可用)。 Each reference must include the title, URL, and site name (if available).

输出格式示例 (Example output format):

回答 (Answer):

<你的回答,包含内联引用,如 [1], [2]。> <Your answer with inline citations like [1], [2].>

参考资料 (References):

[1] <title> <url> 来源 (Source): <siteName>

[2] <title> <url> 来源 (Source): <siteName>

如果未找到可靠的来源,请回复: If no reliable sources are found, reply with: "未找到可靠的来源。(No reliable sources found.)"

错误处理 (Error Handling)

常见的 API 错误代码:

Common API error codes:

  • 400: 请求错误 (Bad request)
  • 401: API Key 无效 (Invalid API key)
  • 403: 余额不足 (Insufficient balance)
  • 429: 请求过于频繁 (Rate limit exceeded)
  • 500: 服务器错误 (Server error)

如需调试,请使用 API 响应中的 log_id。

Use log_id from API responses for debugging if needed.

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,014
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
Skill 文件
  • SKILL.md
    • Bocha Web Search
    • 何时使用此 Skill (When to Use This Skill)
    • API 规范 (API Specification)
      • 工作流程 (Workflow)
        • 第一步:提取搜索参数 (Step 1: Extract Search Parameters)
        • 第二步:发起资源请求 (Step 2: Send API Request)
    • 响应结构 (Response Structure)
    • 引用规则 (Citation Rules - Mandatory)
    • 错误处理 (Error Handling)
  • 项目或源文件

相关 Skill

更多
元宝搜索标准版Skill 元宝搜索标准版Skill Search the web using TencentCloud Web Search API (WSA). Prioritize using it when you need to retrieve network information.
Ollama Web Search Ollama Web Search 使用 Ollama Web Search API 进行网络搜索和网页抓取
Zhipu AI Search Zhipu AI Search 使用智谱 Web Search API 进行网络搜索。当用户需要搜索最新信息、查找实时数据、查询新闻、研究某个话题或获取网络上的信息时使用。支持多种搜索引擎(智谱基础版/高阶版、搜狗、夸克),可配置搜索范围、时间筛选、结果数量等参数。
Ollama Web Search CLI Ollama Web Search CLI 使用 Ollama Web Search API 进行网络搜索和网页抓取
Cstcloud Web Search Cstcloud Web Search 使用中国科技云(CSTCloud)Web Search API 进行网络搜索,国内用户无需国外 API key,直接通过“帮我搜 xxx”调用。