skillfree 0.1.41 → 0.1.63
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/bin/skillfree.js +17 -9
- package/package.json +1 -1
- package/scripts/commands/pilot.js +98 -1
package/bin/skillfree.js
CHANGED
|
@@ -36,15 +36,23 @@ auth
|
|
|
36
36
|
// ── pilot ─────────────────────────────────────────────────────────────────────
|
|
37
37
|
program
|
|
38
38
|
.command('pilot')
|
|
39
|
-
.description('AI 智能调度:chat | image | video | ocr | presentation')
|
|
40
|
-
.option('--type <type>',
|
|
41
|
-
.option('--prompt <text>',
|
|
42
|
-
.option('--file <path>',
|
|
43
|
-
.option('--output <path>',
|
|
44
|
-
.option('--model <model>',
|
|
45
|
-
.option('--size <size>',
|
|
46
|
-
.option('--seconds <sec>',
|
|
47
|
-
.option('--language <lang>',
|
|
39
|
+
.description('AI 智能调度:chat | image | video | ocr | presentation | pharma')
|
|
40
|
+
.option('--type <type>', '调用类型: chat | image | video | ocr | presentation | pharma', 'chat')
|
|
41
|
+
.option('--prompt <text>', '输入提示词')
|
|
42
|
+
.option('--file <path>', '输入文件路径(ocr 用)')
|
|
43
|
+
.option('--output <path>', '输出文件路径')
|
|
44
|
+
.option('--model <model>', '指定模型(可选,不填自动选最优)')
|
|
45
|
+
.option('--size <size>', '图像尺寸 或 视频分辨率(默认 1024x1024 / 1920x1080)')
|
|
46
|
+
.option('--seconds <sec>', '视频时长:4 | 6 | 8(默认 8)', '8')
|
|
47
|
+
.option('--language <lang>', '演示文稿语言(默认 zh-cn)', 'zh-cn')
|
|
48
|
+
.option('--target <target>', '医药查询:靶点(如 STAT6、PD-1)')
|
|
49
|
+
.option('--drug <name>', '医药查询:药品名称')
|
|
50
|
+
.option('--indication <ind>', '医药查询:适应症(如 哮喘、特应性皮炎)')
|
|
51
|
+
.option('--company <company>', '医药查询:研发企业')
|
|
52
|
+
.option('--status <status>', '医药查询:研发阶段(如 Ⅱ期临床、批准上市)')
|
|
53
|
+
.option('--sponsor <sponsor>', '医药查询:申办单位(临床试验用)')
|
|
54
|
+
.option('--keyid <keyid>', '医药查询:药物 keyid(drug-detail 用)')
|
|
55
|
+
.option('--page <page>', '医药查询:页码', '1')
|
|
48
56
|
.action(async (flags) => {
|
|
49
57
|
const { pilot } = require('../scripts/commands/pilot')
|
|
50
58
|
await pilot(flags).catch(e => { console.error('❌', e.message); process.exit(1) })
|
package/package.json
CHANGED
|
@@ -163,7 +163,104 @@ async function pilot(flags) {
|
|
|
163
163
|
return
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
// ── PHARMA(摩熵数科医药数据查询)───────────────────────────────────────────
|
|
167
|
+
if (type === 'pharma') {
|
|
168
|
+
const pharmaModel = model || 'bcpm-drug-dev'
|
|
169
|
+
|
|
170
|
+
// 构建 search 参数(从 flags 透传)
|
|
171
|
+
const search = {}
|
|
172
|
+
if (flags.drug || flags['drug-name']) search.drug_name = flags.drug || flags['drug-name']
|
|
173
|
+
if (flags.target) search.target = flags.target
|
|
174
|
+
if (flags.company) search.company = flags.company
|
|
175
|
+
if (flags.indication) search.indication = flags.indication
|
|
176
|
+
if (flags.status) search.highest_status_cn = flags.status
|
|
177
|
+
if (flags.title) search.title = flags.title
|
|
178
|
+
if (flags.sponsor) search.sponsor = flags.sponsor
|
|
179
|
+
|
|
180
|
+
const inputs = pharmaModel === 'bcpm-drug-detail'
|
|
181
|
+
? { keyid: flags.keyid ?? prompt } // detail 模式需要 keyid
|
|
182
|
+
: { search, page: Number(flags.page ?? 1) }
|
|
183
|
+
|
|
184
|
+
const res = await post('/pharma', { model: pharmaModel, inputs })
|
|
185
|
+
|
|
186
|
+
if (res.error) {
|
|
187
|
+
console.error(`❌ 查询失败: ${res.error.message}`)
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (output) {
|
|
192
|
+
fs.writeFileSync(output, JSON.stringify(res.data, null, 2))
|
|
193
|
+
console.log(`✅ 已保存到 ${output}`)
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// 格式化输出
|
|
198
|
+
const data = res.data
|
|
199
|
+
console.log(`\n📊 ${pharmaModel} 查询结果\n${'─'.repeat(50)}`)
|
|
200
|
+
|
|
201
|
+
if (pharmaModel === 'bcpm-drug-detail') {
|
|
202
|
+
const b = data.baseinfo
|
|
203
|
+
if (b) {
|
|
204
|
+
console.log(`药品: ${b.drug_name_cn || b.drug_name}`)
|
|
205
|
+
console.log(`全球研发阶段: ${b.highest_status_cn}`)
|
|
206
|
+
console.log(`中国研发阶段: ${b.highest_status_china_cn}`)
|
|
207
|
+
console.log(`靶点: ${(b.target_json || []).map(t => t.name_short).join(', ')}`)
|
|
208
|
+
console.log(`作用机制: ${(b.target_action_cn || []).join(', ')}`)
|
|
209
|
+
console.log(`治疗领域: ${(b.therapy_area_cn || []).join(', ')}`)
|
|
210
|
+
}
|
|
211
|
+
if (data.indications?.list?.length) {
|
|
212
|
+
console.log(`\n适应症研发现状(前5条):`)
|
|
213
|
+
data.indications.list.slice(0, 5).forEach(i => {
|
|
214
|
+
console.log(` • ${i.indication?.cn} | ${i.status?.cn} | ${i.company?.cn} | ${i.country?.cn}`)
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
if (data.sales?.list?.length) {
|
|
218
|
+
console.log(`\n全球销售额(最新3年):`)
|
|
219
|
+
data.sales.list.slice(0, 3).forEach(s => {
|
|
220
|
+
console.log(` • ${s.year} ${s.company}: ${s.sales}`)
|
|
221
|
+
})
|
|
222
|
+
}
|
|
223
|
+
} else {
|
|
224
|
+
const list = data.list || []
|
|
225
|
+
const total = data.total || list.length
|
|
226
|
+
console.log(`共 ${total} 条结果,当前显示 ${list.length} 条\n`)
|
|
227
|
+
|
|
228
|
+
if (pharmaModel === 'bcpm-drug-dev') {
|
|
229
|
+
list.slice(0, 10).forEach((item, i) => {
|
|
230
|
+
console.log(`${i + 1}. ${item.drug_name_cn || item.drug_name} (${item.drug_name})`)
|
|
231
|
+
console.log(` keyid: ${item.keyid}`)
|
|
232
|
+
console.log(` 首家: ${item.originator_company_cn || item.originator_company}`)
|
|
233
|
+
console.log(` 全球阶段: ${item.highest_status_cn} 中国阶段: ${item.highest_status_china_cn}`)
|
|
234
|
+
console.log(` 靶点: ${(item.target_short || []).join(', ')}`)
|
|
235
|
+
console.log(` 适应症: ${(item.indication || []).slice(0, 3).join(', ')}`)
|
|
236
|
+
console.log('')
|
|
237
|
+
})
|
|
238
|
+
} else if (pharmaModel === 'bcpm-cn-evaluation') {
|
|
239
|
+
list.slice(0, 10).forEach((item, i) => {
|
|
240
|
+
console.log(`${i + 1}. [${item.acceptances_number}] ${item.drug_name}`)
|
|
241
|
+
console.log(` 企业: ${(item.company || []).join(', ')}`)
|
|
242
|
+
console.log('')
|
|
243
|
+
})
|
|
244
|
+
} else if (pharmaModel === 'bcpm-cn-clinical') {
|
|
245
|
+
list.slice(0, 10).forEach((item, i) => {
|
|
246
|
+
console.log(`${i + 1}. [${item.registration_number}] ${item.drug_name_cn}`)
|
|
247
|
+
console.log(` 适应症: ${item.indication} 分期: ${item.trial_phase}`)
|
|
248
|
+
console.log(` 申办: ${(item.sponsor || []).map(s => s.name).join(', ')}`)
|
|
249
|
+
console.log('')
|
|
250
|
+
})
|
|
251
|
+
} else {
|
|
252
|
+
// 通用输出
|
|
253
|
+
list.slice(0, 10).forEach((item, i) => {
|
|
254
|
+
console.log(`${i + 1}. ${JSON.stringify(item).slice(0, 120)}`)
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
console.log(`${'─'.repeat(50)}`)
|
|
260
|
+
return
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
throw new Error(`不支持的类型: ${type}\n可选: chat | image | video | ocr | presentation | pharma`)
|
|
167
264
|
}
|
|
168
265
|
|
|
169
266
|
module.exports = { pilot }
|