baidu-baike-search
百度百科组件是一款旨在查询各种名词的权威百科解释的知识服务工具。其核心功能是给定用户提供的特定“名词”(物体、人、地点、概念、事件等),返回来自百度百科的标准化、详细的词条解释。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~ide-rea-baidu-baike-searchcURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~ide-rea-baidu-baike-search/file -o ide-rea-baidu-baike-search.md# Baidu Baike This skill allows OpenClaw agents to search detailed entry explanations via Baidu Baike . ## Setup 1. **API Key:** Ensure the BAIDU_API_KEY environment variable is set with your valid API key. 2. **Environment:** The API key should be available in the runtime environment. 3. **BAIDU_API_KEY:** BAIDU_API_KEY available, need to go to the baidu cloud platform(https://login.bce.baidu.com) registered account, if you already have account will go to get the API KEY (https://console.bce.baidu.com/qianfan/ais/console/apiKey) ## API table | name | path | description | |------------|---------------------------------|---------------------------------------| | LemmaList |/v2/baike/lemma/get_list_by_title|Query the list of entries that are the same as this term, and the is_default field in the return represents the subject term| |LemmaContent| /v2/baike/lemma/get_content |Query the entry explanation or detailed content of an entry based on the entry id or entry name, best to do so based on the entry ID| ## Workflow 1. The skill only supports searching for detailed knowledge explanations of objectively existing things such as (things, people, place names, concepts, events), etc. Therefore, please extract such nouns before calling 2. The script makes a GET request to the Baidu Baike Search API 3. The API returns structured search results with lemma_id, desc, url, lemma summary, videos, relations and knowledge, if the "noun" is a well-known person or thing, the associated person or thing of this noun will be returned 4. If the content queried based on the default term name is inaccurate, you can first query the term list by the LemmaList API, and then select the term ID that meets the requirements from the list to query the term content by LemmaContent API 5. The search shell script located at `scripts/baidu_baike.sh` ## APIS ### LemmaList API #### Parameters - `lemma_title`: The search entry name - `top_k`: Number of results to return (default: 5) #### Example Usage ```bash curl -XGET 'https://appbuilder.baidu.com/v2/baike/lemma/get_content?lemma_title=刘德华' \ -H 'Authorization: Bearer BAIDU_API_KEY' ``` ### LemmaContent API #### Parameters - `search_type`: The type of search, optional values include: "lemmaTitle", "lemmaId" - `search_key`: The search key, either the entry name or entry ID #### Example Usage ```bash curl -XGET 'https://appbuilder.baidu.com/v2/baike/lemma/get_content?search_type=lemmaTitle&search_key=刘德华' \ -H 'Authorization: Bearer BAIDU_API_KEY' ``` ## Execute scripts **Example 1: if user just give lemmaTitle** ```bash BAIDU_API_KEY=xxx sh scripts/baidu_baike.sh 'search' '$lemmaTitle' ``` **Example 1: if user just give lemmaId** ```bash BAIDU_API_KEY=xxx sh scripts/baidu_baike.sh 'search_by_id' '$lemmaId' ``` **Example 1: if user just give lemmaTitle,but wish search by lemmaId** ```bash BAIDU_API_KEY=xxx sh scripts/baidu_baike.sh 'list_by_title' '$lemmaTitle' ``` --- ## 中文说明 # 百度百科 此技能允许 OpenClaw 代理通过百度百科搜索详细的词条解释。 ## 设置 1. **API 密钥:** 确保 BAIDU_API_KEY 环境变量已设置为你的有效 API 密钥。 2. **环境:** 该 API 密钥应在运行时环境中可用。 3. **BAIDU_API_KEY:** 需要先在百度云平台(https://login.bce.baidu.com)注册账号才能获得 BAIDU_API_KEY;如果你已有账号,可前往获取 API KEY(https://console.bce.baidu.com/qianfan/ais/console/apiKey) ## API 表 | 名称 | 路径 | 说明 | |------------|---------------------------------|---------------------------------------| | LemmaList |/v2/baike/lemma/get_list_by_title|查询与该词条名称相同的词条列表,返回结果中的 is_default 字段代表主词条| |LemmaContent| /v2/baike/lemma/get_content |根据词条 id 或词条名称查询某个词条的解释或详细内容,最好基于词条 ID 进行查询| ## 工作流程 1. 此技能仅支持搜索客观存在事物(如:事物、人物、地名、概念、事件等)的详细知识解释。因此,请在调用前先提取此类名词 2. 脚本向百度百科搜索 API 发起 GET 请求 3. API 返回结构化搜索结果,包含 lemma_id、desc、url、词条摘要、视频、关系和知识;如果该"名词"是知名人物或事物,将返回与该名词关联的人物或事物 4. 如果根据默认词条名称查询到的内容不准确,可以先通过 LemmaList API 查询词条列表,然后从列表中选择符合要求的词条 ID,再通过 LemmaContent API 查询词条内容 5. 搜索 shell 脚本位于 `scripts/baidu_baike.sh` ## API 接口 ### LemmaList API #### 参数 - `lemma_title`:搜索的词条名称 - `top_k`:返回结果的数量(默认:5) #### 使用示例 ```bash curl -XGET 'https://appbuilder.baidu.com/v2/baike/lemma/get_content?lemma_title=刘德华' \ -H 'Authorization: Bearer BAIDU_API_KEY' ``` ### LemmaContent API #### 参数 - `search_type`:搜索类型,可选值包括:"lemmaTitle"、"lemmaId" - `search_key`:搜索键,即词条名称或词条 ID #### 使用示例 ```bash curl -XGET 'https://appbuilder.baidu.com/v2/baike/lemma/get_content?search_type=lemmaTitle&search_key=刘德华' \ -H 'Authorization: Bearer BAIDU_API_KEY' ``` ## 执行脚本 **示例 1:如果用户仅提供 lemmaTitle** ```bash BAIDU_API_KEY=xxx sh scripts/baidu_baike.sh 'search' '$lemmaTitle' ``` **示例 1:如果用户仅提供 lemmaId** ```bash BAIDU_API_KEY=xxx sh scripts/baidu_baike.sh 'search_by_id' '$lemmaId' ``` **示例 1:如果用户仅提供 lemmaTitle,但希望按 lemmaId 搜索** ```bash BAIDU_API_KEY=xxx sh scripts/baidu_baike.sh 'list_by_title' '$lemmaTitle' ```