@bgicli/bgicli 2.4.9 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # BGI CLI
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@bgicli/bgicli.svg)](https://www.npmjs.com/package/@bgicli/bgicli)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@bgicli/bgicli.svg)](https://www.npmjs.com/package/@bgicli/bgicli)
5
+
3
6
  **BGI CLI** 是面向中国生物学研究者的 AI 终端工具,开箱即用,无需额外配置。
4
7
 
5
- - ✅ **开箱即用**clone 仓库后一键安装即可
8
+ - ✅ **一行安装**`npm install -g @bgicli/bgicli`,无需克隆仓库
6
9
  - ✅ **内置 1001 个技能** — 涵盖生信分析、结构生物学、药物发现、临床等全领域,自动安装
7
10
  - ✅ **智能技能路由** — 描述任务自动激活对应技能,无需手动搜索
8
11
  - ✅ **中国 AI 服务商** — 百炼(DashScope)聚合:Qwen、DeepSeek、Kimi、MiniMax 等 20+ 模型
@@ -16,22 +19,9 @@
16
19
  **环境要求:** Node.js 18+
17
20
 
18
21
  ```bash
19
- git clone https://gitlab.genomics.cn/ai/bgi-cli.git
20
- cd bgi-cli
21
- npm install
22
- npm run build
23
- sudo npm link
22
+ npm install -g @bgicli/bgicli
24
23
  ```
25
24
 
26
- > **macOS / Linux 无 root 权限时**,`npm link` 可能报 EACCES 权限错误,需先配置 npm 用户目录:
27
- > ```bash
28
- > mkdir -p ~/.npm-global
29
- > npm config set prefix '~/.npm-global'
30
- > echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc # zsh 用户改为 ~/.zshrc
31
- > source ~/.bashrc
32
- > npm link # 再次执行
33
- > ```
34
-
35
25
  安装完成后直接运行:
36
26
 
37
27
  ```bash
@@ -46,8 +36,7 @@ bgi
46
36
 
47
37
  ```bash
48
38
  # 卸载命令行工具
49
- cd bgi-cli
50
- npm unlink
39
+ npm uninstall -g @bgicli/bgicli
51
40
 
52
41
  # 删除本地数据(配置、技能库)
53
42
  # Linux / macOS
@@ -0,0 +1,73 @@
1
+ ---
2
+ id: web-search
3
+ name: Web Search (网络搜索)
4
+ category: utility
5
+ short-description: Search the internet using DuckDuckGo API and curl/Python for any query.
6
+ ---
7
+
8
+ # Web Search 网络搜索
9
+
10
+ 当用户需要搜索互联网、查找最新信息、核实事实、或查询非文献数据库内容时,使用以下方法通过 bash 工具执行网络搜索。
11
+
12
+ ## 规则
13
+ - 直接搜索,不要事先询问"是否需要搜索"
14
+ - 搜索到内容后,整合总结后再回复,不要直接粘贴原始 JSON
15
+ - 如果首次搜索结果不理想,换关键词重试一次
16
+ - 中文问题优先用中文关键词;专业术语用英文效果更好
17
+
18
+ ## 方法一:DuckDuckGo Instant Answer(无需 API Key,适合快速摘要)
19
+
20
+ ```bash
21
+ python3 - <<'EOF'
22
+ import urllib.request, urllib.parse, json, sys
23
+
24
+ query = "YOUR_QUERY_HERE"
25
+ url = "https://api.duckduckgo.com/?q=" + urllib.parse.quote(query) + "&format=json&no_html=1&skip_disambig=1"
26
+ try:
27
+ with urllib.request.urlopen(url, timeout=10) as r:
28
+ d = json.loads(r.read())
29
+ if d.get("AbstractText"):
30
+ print("摘要:", d["AbstractText"])
31
+ print("来源:", d.get("AbstractURL", ""))
32
+ topics = [t for t in d.get("RelatedTopics", []) if isinstance(t, dict) and t.get("Text")]
33
+ for t in topics[:6]:
34
+ print("•", t["Text"])
35
+ if t.get("FirstURL"):
36
+ print(" ", t["FirstURL"])
37
+ except Exception as e:
38
+ print("搜索失败:", e, file=sys.stderr)
39
+ EOF
40
+ ```
41
+
42
+ ## 方法二:获取并解析具体网页内容
43
+
44
+ ```bash
45
+ python3 - <<'EOF'
46
+ import urllib.request, re, sys
47
+
48
+ url = "https://TARGET_URL_HERE"
49
+ try:
50
+ req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
51
+ with urllib.request.urlopen(req, timeout=15) as r:
52
+ html = r.read().decode("utf-8", errors="ignore")
53
+ text = re.sub(r"<script[^>]*>[\s\S]*?</script>", "", html, flags=re.I)
54
+ text = re.sub(r"<style[^>]*>[\s\S]*?</style>", "", text, flags=re.I)
55
+ text = re.sub(r"<[^>]+>", " ", text)
56
+ text = re.sub(r"\s{3,}", "\n\n", text)
57
+ print(text[:4000])
58
+ except Exception as e:
59
+ print("获取失败:", e, file=sys.stderr)
60
+ EOF
61
+ ```
62
+
63
+ ## 方法三:curl 快速搜索
64
+
65
+ ```bash
66
+ curl -sA "Mozilla/5.0" "https://api.duckduckgo.com/?q=QUERY&format=json&no_html=1" \
67
+ | python3 -c "
68
+ import json,sys
69
+ d=json.load(sys.stdin)
70
+ print(d.get('AbstractText',''))
71
+ [print('•',t['Text']) for t in d.get('RelatedTopics',[])[:5] if isinstance(t,dict) and t.get('Text')]
72
+ "
73
+ ```