skillfree 0.1.25 → 0.1.37

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.
@@ -1,47 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const { run } = require('./run')
4
-
5
- /**
6
- * Speech-to-text command
7
- * @param {object} params - STT parameters
8
- * @param {string} params.file - Local audio file path
9
- * @param {string} [params.model] - Model (default: openai/whisper-1)
10
- * @param {string} [params.prompt] - Optional prompt to guide transcription style
11
- * @param {string} [params.language] - Optional language code (e.g., "en")
12
- * @param {string} [params.output] - Optional output file path for transcript
13
- * @returns {Promise<object>} STT result with transcribed text
14
- */
15
- async function stt(params) {
16
- if (!params.file) {
17
- throw new Error('--file is required for STT (local audio file path)')
18
- }
19
-
20
- const filePath = path.resolve(params.file)
21
- if (!fs.existsSync(filePath)) {
22
- throw new Error(`Audio file not found: ${filePath}`)
23
- }
24
-
25
- const audioData = fs.readFileSync(filePath).toString('base64')
26
- const filename = path.basename(filePath)
27
-
28
- const inputs = {
29
- audio_data: audioData,
30
- filename,
31
- }
32
- if (params.prompt) inputs.prompt = params.prompt
33
- if (params.language) inputs.language = params.language
34
-
35
- const model = params.model || 'openai/whisper-1'
36
- const result = await run({ model, inputs })
37
-
38
- const text = result.text || JSON.stringify(result)
39
-
40
- if (params.output) {
41
- fs.writeFileSync(params.output, text)
42
- }
43
-
44
- return { text, ...(params.output ? { saved: params.output } : {}) }
45
- }
46
-
47
- module.exports = { stt }
@@ -1,67 +0,0 @@
1
- const { run } = require('./run')
2
-
3
- /**
4
- * Text-to-speech command
5
- * @param {object} params - TTS parameters
6
- * @param {string} params.model - Model in "vendor/model" format
7
- * @param {string} params.text - Text to synthesize
8
- * @param {string} [params.voiceId] - Voice ID (provider-specific)
9
- * @param {string} params.output - Output audio file path
10
- * @returns {Promise<object>} TTS result
11
- */
12
- async function tts(params) {
13
- if (!params.text) {
14
- throw new Error('--text is required for TTS')
15
- }
16
- if (!params.output) {
17
- throw new Error('--output is required for TTS')
18
- }
19
-
20
- const inputs = {}
21
-
22
- // Provider-specific input mapping
23
- const [vendor] = params.model.split('/')
24
- if (vendor === 'elevenlabs') {
25
- // ElevenLabs uses 'text' and requires voice_id - default to "Rachel"
26
- inputs.text = params.text
27
- inputs.voice_id = params.voiceId || 'EXAVITQu4vr4xnSDxMaL'
28
- } else if (vendor === 'minimax') {
29
- // MiniMax uses 'text' and 'voice_setting' object
30
- inputs.text = params.text
31
- inputs.voice_setting = {
32
- voice_id: params.voiceId || 'male-qn-qingse',
33
- speed: 1.0,
34
- vol: 1.0,
35
- pitch: 0,
36
- }
37
- } else if (vendor === 'openai') {
38
- // OpenAI TTS uses 'input' and 'voice'
39
- inputs.input = params.text
40
- inputs.voice = params.voiceId || 'alloy'
41
- } else if (vendor === 'replicate') {
42
- // Replicate XTTS uses 'text' and requires 'speaker' (audio URL for voice cloning)
43
- inputs.text = params.text
44
- if (params.speaker) {
45
- inputs.speaker = params.speaker
46
- } else if (params.voiceId) {
47
- inputs.speaker = params.voiceId
48
- } else {
49
- // Default speaker sample
50
- inputs.speaker =
51
- 'https://replicate.delivery/pbxt/Jt79w0xsT64R1JsiJ0LQRL8UcWspg5J4RFrU6YwEKpOT1ukS/male.wav'
52
- }
53
- } else if (vendor === 'mm') {
54
- // MM TTS (qwen3-tts-flash) uses 'text' and optional 'voice'
55
- inputs.text = params.text
56
- if (params.voiceId) {
57
- inputs.voice = params.voiceId
58
- }
59
- } else {
60
- // Default: use 'text'
61
- inputs.text = params.text
62
- }
63
-
64
- return run({ model: params.model, inputs, output: params.output })
65
- }
66
-
67
- module.exports = { tts }