@pptalker/agent 1.0.2 → 1.0.3
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/dist/config.js +17 -1
- package/dist/index.js +5 -0
- package/dist/tools/render.js +5 -1
- package/package.json +1 -1
- package/pptalker-agent.zip +0 -0
- package/skills/pptalker-agent/SKILL.md +5 -1
package/dist/config.js
CHANGED
|
@@ -39,11 +39,27 @@ export function loadConfig(env = process.env) {
|
|
|
39
39
|
if (!Number.isInteger(defaultSpeed) || defaultSpeed < 80 || defaultSpeed > 150) {
|
|
40
40
|
throw new Error('PPTALKER_SPEED 必须为 80–150 的整数');
|
|
41
41
|
}
|
|
42
|
+
// 字幕逐维可配;未设置时用后端默认(显示、字号 medium、白色、半透明底)。
|
|
43
|
+
const rawSubtitles = env.PPTALKER_SUBTITLES;
|
|
44
|
+
let defaultSubtitles = null;
|
|
45
|
+
if (rawSubtitles !== undefined && rawSubtitles !== '') {
|
|
46
|
+
if (!['true', 'false'].includes(rawSubtitles)) throw new Error('PPTALKER_SUBTITLES 只能是 true 或 false');
|
|
47
|
+
defaultSubtitles = rawSubtitles === 'true';
|
|
48
|
+
}
|
|
49
|
+
const pick = (name, allowed) => {
|
|
50
|
+
const value = (env[name] || '').trim().toLowerCase() || null;
|
|
51
|
+
if (value && !allowed.includes(value)) throw new Error(`${name} 只能是 ${allowed.join(' / ')}`);
|
|
52
|
+
return value;
|
|
53
|
+
};
|
|
54
|
+
const defaultSubtitleSize = pick('PPTALKER_SUBTITLE_SIZE', ['small', 'medium', 'large']);
|
|
55
|
+
const defaultSubtitleColor = pick('PPTALKER_SUBTITLE_COLOR', ['white', 'yellow', 'black', 'blue']);
|
|
56
|
+
const defaultSubtitleBg = pick('PPTALKER_SUBTITLE_BG', ['none', 'semi-transparent', 'solid']);
|
|
42
57
|
const cacheDir = env.PPTALKER_RECOVERY_DIR === 'off' ? null
|
|
43
58
|
: env.PPTALKER_RECOVERY_DIR || join(homedir(), '.pptalker-agent', 'recovery', 'v2');
|
|
44
59
|
if (cacheDir && !isAbsolute(cacheDir)) throw new Error('PPTALKER_RECOVERY_DIR 必须为绝对路径或 off');
|
|
45
60
|
return { apiBase: url.toString().replace(/\/+$/, ''), apiKey, waitSeconds, operationSeconds,
|
|
46
61
|
cacheDir, defaultLanguage: env.PPTALKER_LANGUAGE || 'zh-CN', defaultStyle,
|
|
47
|
-
defaultVoice, defaultSpeed
|
|
62
|
+
defaultVoice, defaultSpeed, defaultSubtitles, defaultSubtitleSize,
|
|
63
|
+
defaultSubtitleColor, defaultSubtitleBg };
|
|
48
64
|
}
|
|
49
65
|
export const CONFIG_HELP = '设置 PPTALKER_AGENT_API_BASE(独立 Agent endpoint)及 PPTALKER_API_KEY。';
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,11 @@ const RenderInput = z.object({
|
|
|
33
33
|
voice: z.string().max(80).optional().describe('音色名称或 ID,可取 account 返回的 voices(标准音色)或 cloned_voices(克隆音色)。不传则用 PPTALKER_VOICE 或该语言默认音色。'),
|
|
34
34
|
style: z.enum(['clean', 'bold']).optional(),
|
|
35
35
|
speed: z.number().int().min(80).max(150).optional().describe('语速 80–150;不传则用 PPTALKER_SPEED(默认 100)。慢≈85,快≈120。'),
|
|
36
|
+
subtitles: z.boolean().optional().describe('是否显示字幕;不传则用 PPTALKER_SUBTITLES(默认显示)。'),
|
|
37
|
+
subtitle_size: z.enum(['small', 'medium', 'large']).optional().describe('字幕字号档位,默认 medium。'),
|
|
38
|
+
subtitle_color: z.enum(['white', 'yellow', 'black', 'blue']).optional().describe('字幕颜色,默认 white。'),
|
|
39
|
+
subtitle_bg: z.enum(['none', 'semi-transparent', 'solid']).optional()
|
|
40
|
+
.describe('字幕背景:none 无底 / semi-transparent 半透明黑底 / solid 实心黑底,默认 semi-transparent。'),
|
|
36
41
|
video_title: z.string().max(200).optional().describe('视频标题;对应当前独立后端的 video_title 字段。'),
|
|
37
42
|
is_public: z.boolean().default(false).describe('是否生成公开分享页;默认 false(私有,只给临时签名链接)。'),
|
|
38
43
|
wait,
|
package/dist/tools/render.js
CHANGED
|
@@ -103,7 +103,11 @@ export async function handleRender(client, cfg, input, extra = {}) {
|
|
|
103
103
|
voice: input.voice || cfg.defaultVoice || undefined,
|
|
104
104
|
style: input.style || cfg.defaultStyle,
|
|
105
105
|
speed: input.speed ?? cfg.defaultSpeed ?? 100,
|
|
106
|
-
video_title: input.video_title || '', is_public: input.is_public === true
|
|
106
|
+
video_title: input.video_title || '', is_public: input.is_public === true,
|
|
107
|
+
subtitles: input.subtitles ?? cfg.defaultSubtitles ?? undefined,
|
|
108
|
+
subtitle_size: input.subtitle_size || cfg.defaultSubtitleSize || undefined,
|
|
109
|
+
subtitle_color: input.subtitle_color || cfg.defaultSubtitleColor || undefined,
|
|
110
|
+
subtitle_bg: input.subtitle_bg || cfg.defaultSubtitleBg || undefined },
|
|
107
111
|
}), Math.min(120000, remaining()), extra.signal);
|
|
108
112
|
const result = normalizeTask(raw, { ...context, submission: 'accepted' });
|
|
109
113
|
context = result;
|
package/package.json
CHANGED
package/pptalker-agent.zip
CHANGED
|
Binary file
|
|
@@ -46,10 +46,14 @@ Key 从 https://www.pptalker.com/profile 获取,与网页端用的是同一个
|
|
|
46
46
|
|---|---|---|---|
|
|
47
47
|
| `PPTALKER_AGENT_API_BASE` | ✅ | — | `https://api.pptalker.com`。只填 origin,**不要带 `/api/v1/agent`**,带上会直接报配置错误 |
|
|
48
48
|
| `PPTALKER_API_KEY` | ✅ | — | `pptk_live_` 开头的 key |
|
|
49
|
-
| `PPTALKER_LANGUAGE` | — | `zh-CN` |
|
|
49
|
+
| `PPTALKER_LANGUAGE` | — | `zh-CN` | 默认旁白语言。接受 BCP-47(`zh-CN`)或友好名(`Chinese`/`中文`/`English`) |
|
|
50
50
|
| `PPTALKER_STYLE` | — | `clean` | `clean` 或 `bold` |
|
|
51
51
|
| `PPTALKER_VOICE` | — | 按语言取 | 全局默认音色。标准音色填名称或 ID,克隆音色填 `cloned_voices` 里的 `name` 或 `id` |
|
|
52
52
|
| `PPTALKER_SPEED` | — | `100` | 全局默认语速,整数 80–150 |
|
|
53
|
+
| `PPTALKER_SUBTITLES` | — | 显示 | 是否显示字幕,`true`/`false` |
|
|
54
|
+
| `PPTALKER_SUBTITLE_SIZE` | — | `medium` | 字幕字号 `small`/`medium`/`large` |
|
|
55
|
+
| `PPTALKER_SUBTITLE_COLOR` | — | `white` | 字幕颜色 `white`/`yellow`/`black`/`blue` |
|
|
56
|
+
| `PPTALKER_SUBTITLE_BG` | — | `semi-transparent` | 字幕背景 `none`/`semi-transparent`/`solid` |
|
|
53
57
|
| `PPTALKER_WAIT_SECONDS` | — | `30` | 仅 `wait=true` 时的客户端轮询预算,整数 10–45 |
|
|
54
58
|
| `PPTALKER_OPERATION_SECONDS` | — | `180` | 单个新任务的总预算(上传 + 首次解析),整数 10–300 |
|
|
55
59
|
| `PPTALKER_RECOVERY_DIR` | — | `~/.pptalker-agent/recovery/v2` | 本地恢复日志目录;填 `off` 关闭(关闭后中断任务只能靠用户自己记 id) |
|