skillfree 0.1.13 → 0.1.14
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 +11 -1
- package/package.json +1 -1
- package/scripts/commands/models.js +27 -23
- package/scripts/commands/pilot.js +2 -2
package/bin/skillfree.js
CHANGED
|
@@ -54,6 +54,16 @@ program
|
|
|
54
54
|
await pilot({ type: 'chat', prompt, ...flags }).catch(e => { console.error('❌', e.message); process.exit(1) })
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
+
// ── models ────────────────────────────────────────────────────────────────────
|
|
58
|
+
program
|
|
59
|
+
.command('models')
|
|
60
|
+
.description('查看所有可用模型')
|
|
61
|
+
.option('--type <type>', '按类型过滤: chat | image | tts | video | music | ocr | embedding')
|
|
62
|
+
.action(async (flags) => {
|
|
63
|
+
const { listModels } = require('../scripts/commands/models')
|
|
64
|
+
await listModels(flags.type).catch(e => { console.error('❌', e.message); process.exit(1) })
|
|
65
|
+
})
|
|
66
|
+
|
|
57
67
|
// ── balance ───────────────────────────────────────────────────────────────────
|
|
58
68
|
program
|
|
59
69
|
.command('balance')
|
|
@@ -100,7 +110,7 @@ program
|
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
// 视频任务
|
|
103
|
-
const res = await request(`/
|
|
113
|
+
const res = await request(`/tasks/${taskId}`, { method: 'GET' })
|
|
104
114
|
const task = await res.json()
|
|
105
115
|
console.log(`\n📋 任务 ${taskId}`)
|
|
106
116
|
console.log(` 状态:${task.status}`)
|
package/package.json
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { request } = require('../lib/client')
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @param {string} [params.vendor] - Filter by vendor
|
|
8
|
-
* @returns {Promise<object>} Models list
|
|
9
|
-
*/
|
|
10
|
-
async function listModels(params = {}) {
|
|
11
|
-
const response = await apiHubGet('/v1/models')
|
|
12
|
-
let models = response.models || []
|
|
3
|
+
async function listModels(type) {
|
|
4
|
+
const res = await request('/models', { method: 'GET' })
|
|
5
|
+
const data = await res.json()
|
|
6
|
+
const all = data.data || []
|
|
13
7
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)
|
|
8
|
+
const groups = {}
|
|
9
|
+
for (const m of all) {
|
|
10
|
+
const t = m.type || 'chat'
|
|
11
|
+
if (type && t !== type) continue
|
|
12
|
+
if (!groups[t]) groups[t] = []
|
|
13
|
+
groups[t].push(m.id)
|
|
21
14
|
}
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
const typeLabel = {
|
|
17
|
+
chat: '💬 对话',
|
|
18
|
+
image: '🎨 图像',
|
|
19
|
+
tts: '🔊 语音合成',
|
|
20
|
+
video: '🎬 视频',
|
|
21
|
+
music: '🎵 音乐',
|
|
22
|
+
ocr: '📄 OCR',
|
|
23
|
+
embedding: '🔢 Embedding',
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
console.log('\n🦞 SkillFree 可用模型\n')
|
|
27
|
+
for (const [t, ids] of Object.entries(groups)) {
|
|
28
|
+
console.log(`${typeLabel[t] || t}`)
|
|
29
|
+
ids.forEach(id => console.log(` ${id}`))
|
|
30
|
+
console.log()
|
|
31
|
+
}
|
|
32
|
+
console.log(`共 ${all.length} 个模型`)
|
|
33
|
+
console.log(`\n用法示例:skillfree pilot --type chat --model DeepSeek-V3.2-Fast --prompt "你好"`)
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
module.exports = { listModels }
|
|
@@ -339,7 +339,7 @@ async function pilot(flags) {
|
|
|
339
339
|
|
|
340
340
|
// 1. 提交任务
|
|
341
341
|
process.stdout.write(`🎬 提交视频任务(${videoModel})...`)
|
|
342
|
-
const res = await request('/
|
|
342
|
+
const res = await request('/video/generations', {
|
|
343
343
|
method: 'POST',
|
|
344
344
|
body: JSON.stringify({ model: videoModel, prompt }),
|
|
345
345
|
})
|
|
@@ -357,7 +357,7 @@ async function pilot(flags) {
|
|
|
357
357
|
|
|
358
358
|
while (Date.now() - start < maxWait) {
|
|
359
359
|
await new Promise(r => setTimeout(r, interval))
|
|
360
|
-
const pollRes = await request(`/
|
|
360
|
+
const pollRes = await request(`/tasks/${taskId}`, { method: 'GET' })
|
|
361
361
|
const task = await pollRes.json()
|
|
362
362
|
const status = task.status
|
|
363
363
|
|