skillfree 0.1.64 → 0.1.65
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/SKILL.md +19 -2
- package/bin/skillfree.js +2 -1
- package/package.json +1 -1
- package/scripts/commands/pilot.js +48 -1
package/SKILL.md
CHANGED
|
@@ -192,12 +192,28 @@ skillfree pilot --type pharma --model bcpm-drug-detail --keyid 0b0566619e92554c9
|
|
|
192
192
|
|
|
193
193
|
---
|
|
194
194
|
|
|
195
|
-
## 🌐 实时搜索(
|
|
195
|
+
## 🌐 实时搜索(search)
|
|
196
196
|
|
|
197
197
|
```bash
|
|
198
|
-
|
|
198
|
+
# 基本搜索(默认返回 5 条结果 + AI 摘要)
|
|
199
|
+
skillfree pilot --type search --prompt "STAT6抑制剂最新临床进展"
|
|
200
|
+
|
|
201
|
+
# 指定返回结果数量
|
|
202
|
+
skillfree pilot --type search --prompt "2025年中国新能源汽车市场规模" --limit 10
|
|
203
|
+
|
|
204
|
+
# 保存完整 JSON 结果
|
|
205
|
+
skillfree pilot --type search --prompt "度普利尤单抗竞品分析" --output result.json
|
|
206
|
+
|
|
207
|
+
# 使用高级搜索(更深度,费用略高)
|
|
208
|
+
skillfree pilot --type search --prompt "PD-1抑制剂市场格局" --model tavily-search-advanced
|
|
199
209
|
```
|
|
200
210
|
|
|
211
|
+
**输出内容:** AI 摘要 + 各结果的标题、链接、摘要片段
|
|
212
|
+
|
|
213
|
+
**可用模型:**
|
|
214
|
+
- `tavily-search`(默认)— 标准搜索
|
|
215
|
+
- `tavily-search-advanced` — 深度搜索,结果更全面
|
|
216
|
+
|
|
201
217
|
---
|
|
202
218
|
|
|
203
219
|
## 🔧 其他常用命令
|
|
@@ -224,6 +240,7 @@ skillfree update # 更新到最新版本
|
|
|
224
240
|
| 识别PDF/OCR扫描件 | `skillfree pilot --type ocr --file <路径>` |
|
|
225
241
|
| 做PPT/演示文稿 | `skillfree ppt "..."` |
|
|
226
242
|
| 查药物/查靶点/查临床 | `skillfree pilot --type pharma --target "..."` |
|
|
243
|
+
| 搜索网页/查新闻/实时信息 | `skillfree pilot --type search --prompt "..."` |
|
|
227
244
|
| 查账户余额 | `skillfree balance` |
|
|
228
245
|
|
|
229
246
|
---
|
package/bin/skillfree.js
CHANGED
|
@@ -37,7 +37,7 @@ auth
|
|
|
37
37
|
program
|
|
38
38
|
.command('pilot')
|
|
39
39
|
.description('AI 智能调度:chat | image | video | ocr | presentation | pharma')
|
|
40
|
-
.option('--type <type>', '调用类型: chat | image | video | ocr | presentation | pharma', 'chat')
|
|
40
|
+
.option('--type <type>', '调用类型: chat | image | video | ocr | presentation | pharma | search', 'chat')
|
|
41
41
|
.option('--prompt <text>', '输入提示词')
|
|
42
42
|
.option('--file <path>', '输入文件路径(ocr 用)')
|
|
43
43
|
.option('--output <path>', '输出文件路径')
|
|
@@ -53,6 +53,7 @@ program
|
|
|
53
53
|
.option('--sponsor <sponsor>', '医药查询:申办单位(临床试验用)')
|
|
54
54
|
.option('--keyid <keyid>', '医药查询:药物 keyid(drug-detail 用)')
|
|
55
55
|
.option('--page <page>', '医药查询:页码', '1')
|
|
56
|
+
.option('--limit <n>', '搜索结果数量(search 用,默认 5)')
|
|
56
57
|
.action(async (flags) => {
|
|
57
58
|
const { pilot } = require('../scripts/commands/pilot')
|
|
58
59
|
await pilot(flags).catch(e => { console.error('❌', e.message); process.exit(1) })
|
package/package.json
CHANGED
|
@@ -156,6 +156,53 @@ async function pilot(flags) {
|
|
|
156
156
|
return
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
// ── SEARCH(Tavily 实时网页搜索)────────────────────────────────────────────
|
|
160
|
+
if (type === 'search') {
|
|
161
|
+
if (!prompt) throw new Error('--prompt 是必需的(搜索关键词)')
|
|
162
|
+
const searchModel = model || 'tavily-search'
|
|
163
|
+
const apiKey = getApiKey()
|
|
164
|
+
|
|
165
|
+
console.log(`🔍 搜索中:${prompt}\n`)
|
|
166
|
+
|
|
167
|
+
const res = await fetch(`${BASE_URL}/v1/search`, {
|
|
168
|
+
method: 'POST',
|
|
169
|
+
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
170
|
+
body: JSON.stringify({
|
|
171
|
+
model: searchModel,
|
|
172
|
+
query: prompt,
|
|
173
|
+
include_answer: true,
|
|
174
|
+
include_images: false,
|
|
175
|
+
max_results: flags.limit ? Number(flags.limit) : 5,
|
|
176
|
+
}),
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
const data = await res.json()
|
|
180
|
+
if (!res.ok || data.error) throw new Error(data.error?.message || `HTTP ${res.status}`)
|
|
181
|
+
|
|
182
|
+
// 格式化输出
|
|
183
|
+
if (data.answer) {
|
|
184
|
+
console.log(`💡 AI 摘要\n${'─'.repeat(50)}`)
|
|
185
|
+
console.log(data.answer)
|
|
186
|
+
console.log()
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (data.results?.length) {
|
|
190
|
+
console.log(`📄 搜索结果(共 ${data.results.length} 条)\n${'─'.repeat(50)}`)
|
|
191
|
+
data.results.forEach((r, i) => {
|
|
192
|
+
console.log(`${i + 1}. ${r.title}`)
|
|
193
|
+
console.log(` 🔗 ${r.url}`)
|
|
194
|
+
if (r.content) console.log(` ${r.content.slice(0, 200).replace(/\n/g, ' ')}...`)
|
|
195
|
+
console.log()
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (output) {
|
|
200
|
+
fs.writeFileSync(output, JSON.stringify(data, null, 2))
|
|
201
|
+
console.log(`✅ 完整结果已保存到 ${output}`)
|
|
202
|
+
}
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
|
|
159
206
|
// ── PRESENTATION(AI 演示文稿,异步轮询)────────────────────────────────────
|
|
160
207
|
if (type === 'presentation') {
|
|
161
208
|
const { createPresentation } = require('./presentation')
|
|
@@ -260,7 +307,7 @@ async function pilot(flags) {
|
|
|
260
307
|
return
|
|
261
308
|
}
|
|
262
309
|
|
|
263
|
-
throw new Error(`不支持的类型: ${type}\n可选: chat | image | video | ocr | presentation | pharma`)
|
|
310
|
+
throw new Error(`不支持的类型: ${type}\n可选: chat | image | video | ocr | presentation | pharma | search`)
|
|
264
311
|
}
|
|
265
312
|
|
|
266
313
|
module.exports = { pilot }
|