skillfree 0.1.15 → 0.1.17

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 CHANGED
@@ -29,17 +29,18 @@ auth
29
29
  // ── pilot ─────────────────────────────────────────────────────────────────────
30
30
  program
31
31
  .command('pilot')
32
- .description('AI 智能调度,支持 chat / image / tts / stt / video / music')
33
- .option('--type <type>', '调用类型: chat | image | tts | stt | video | music', 'chat')
34
- .option('--prompt <text>', '输入提示词')
35
- .option('--text <text>', '文字内容(tts 用)')
36
- .option('--file <path>', '输入文件路径(stt 用)')
37
- .option('--output <path>', '输出文件路径')
38
- .option('--model <model>', '指定模型(可选)')
39
- .option('--voice <voice>', 'TTS 声音(默认 nova)')
40
- .option('--size <size>', '图像尺寸(默认 1024x1024)')
41
- .option('--duration <sec>', '视频/音乐时长(秒)')
42
- .option('--lyrics <text>', '歌词(music-2.5 用,支持 [verse][chorus] 标签)')
32
+ .description('AI 智能调度,支持 chat / image / tts / stt / video / music / search')
33
+ .option('--type <type>', '调用类型: chat | image | tts | stt | video | music | ocr | embedding | search', 'chat')
34
+ .option('--prompt <text>', '输入提示词 / 搜索词')
35
+ .option('--text <text>', '文字内容(tts 用)')
36
+ .option('--file <path>', '输入文件路径(stt 用)')
37
+ .option('--output <path>', '输出文件路径')
38
+ .option('--model <model>', '指定模型(可选)')
39
+ .option('--voice <voice>', 'TTS 声音(默认 nova)')
40
+ .option('--size <size>', '图像尺寸(默认 1024x1024)')
41
+ .option('--duration <sec>', '视频/音乐时长(秒)')
42
+ .option('--lyrics <text>', '歌词(music-2.5 用,支持 [verse][chorus] 标签)')
43
+ .option('--max-results <n>', '搜索结果数量(search 用,默认 5)', '5')
43
44
  .action(async (flags) => {
44
45
  const { pilot } = require('../scripts/commands/pilot')
45
46
  await pilot(flags).catch(e => { console.error('❌', e.message); process.exit(1) })
@@ -120,10 +121,11 @@ program
120
121
  console.log(`\n📋 任务 ${taskId}`)
121
122
  console.log(` 状态:${task.status}`)
122
123
  console.log(` 模型:${task.model}`)
123
- if (task.status === 'completed' && task.output_url) {
124
- console.log(` 链接:${task.output_url}`)
124
+ const videoUrl = task.result_url || task.output_url
125
+ if (task.status === 'completed' && videoUrl) {
126
+ console.log(` 链接:${videoUrl}`)
125
127
  if (flags.output) {
126
- const resp = await fetch(task.output_url)
128
+ const resp = await fetch(videoUrl)
127
129
  fs.writeFileSync(flags.output, Buffer.from(await resp.arrayBuffer()))
128
130
  console.log(`✅ 已下载到 ${flags.output}`)
129
131
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillfree",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "🦞 一个 API,满足所有龙虾技能需求",
5
5
  "main": "bin/skillfree.js",
6
6
  "bin": {
@@ -369,7 +369,7 @@ async function pilot(flags) {
369
369
 
370
370
  if (status === 'completed') {
371
371
  console.log('\n')
372
- const videoUrl = task.output_url
372
+ const videoUrl = task.result_url || task.output_url
373
373
  if (!videoUrl) throw new Error('任务完成但未返回视频 URL: ' + JSON.stringify(task))
374
374
 
375
375
  if (output) {
@@ -394,7 +394,43 @@ async function pilot(flags) {
394
394
  return
395
395
  }
396
396
 
397
- throw new Error(`不支持的类型: ${type},可选: chat | image | tts | stt | music | ocr | video | embedding`)
397
+ // ── SEARCH ────────────────────────────────────────────────────────────────────
398
+ if (type === 'search') {
399
+ if (!prompt) throw new Error('--prompt 是必需的(搜索词)')
400
+ const searchModel = model || 'tavily-search'
401
+ const res = await request('/search', {
402
+ method: 'POST',
403
+ body: JSON.stringify({
404
+ model: searchModel,
405
+ query: prompt,
406
+ include_answer: true,
407
+ max_results: flags.maxResults || 5,
408
+ }),
409
+ })
410
+ const data = await res.json()
411
+ if (data.error) throw new Error(data.error.message || JSON.stringify(data.error))
412
+
413
+ // 输出格式化结果
414
+ if (data.answer) {
415
+ console.log('\n📝 摘要答案:')
416
+ console.log(data.answer)
417
+ }
418
+ if (data.results?.length) {
419
+ console.log(`\n🔗 搜索结果(共 ${data.results.length} 条):`)
420
+ data.results.forEach((r, i) => {
421
+ console.log(`\n${i+1}. ${r.title}`)
422
+ console.log(` ${r.url}`)
423
+ if (r.content) console.log(` ${r.content.slice(0, 150)}...`)
424
+ })
425
+ }
426
+ if (output) {
427
+ fs.writeFileSync(output, JSON.stringify(data, null, 2))
428
+ console.log(`\n✅ 完整结果已保存到 ${output}`)
429
+ }
430
+ return
431
+ }
432
+
433
+ throw new Error(`不支持的类型: ${type},可选: chat | image | tts | stt | music | ocr | video | embedding | search`)
398
434
  }
399
435
 
400
436
  module.exports = { pilot }