@pptalker/agent 1.0.1 → 1.0.2

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 CHANGED
@@ -32,10 +32,18 @@ export function loadConfig(env = process.env) {
32
32
  }
33
33
  const defaultStyle = env.PPTALKER_STYLE || 'clean';
34
34
  if (!['clean', 'bold'].includes(defaultStyle)) throw new Error('PPTALKER_STYLE 无效');
35
+ // 全局默认音色 / 语速:调用时可用 voice / speed 覆盖,留空表示按语言自动取。
36
+ const defaultVoice = (env.PPTALKER_VOICE || '').trim() || null;
37
+ if (defaultVoice && defaultVoice.length > 80) throw new Error('PPTALKER_VOICE 过长');
38
+ const defaultSpeed = Number(env.PPTALKER_SPEED || 100);
39
+ if (!Number.isInteger(defaultSpeed) || defaultSpeed < 80 || defaultSpeed > 150) {
40
+ throw new Error('PPTALKER_SPEED 必须为 80–150 的整数');
41
+ }
35
42
  const cacheDir = env.PPTALKER_RECOVERY_DIR === 'off' ? null
36
43
  : env.PPTALKER_RECOVERY_DIR || join(homedir(), '.pptalker-agent', 'recovery', 'v2');
37
44
  if (cacheDir && !isAbsolute(cacheDir)) throw new Error('PPTALKER_RECOVERY_DIR 必须为绝对路径或 off');
38
45
  return { apiBase: url.toString().replace(/\/+$/, ''), apiKey, waitSeconds, operationSeconds,
39
- cacheDir, defaultLanguage: env.PPTALKER_LANGUAGE || 'zh-CN', defaultStyle };
46
+ cacheDir, defaultLanguage: env.PPTALKER_LANGUAGE || 'zh-CN', defaultStyle,
47
+ defaultVoice, defaultSpeed };
40
48
  }
41
49
  export const CONFIG_HELP = '设置 PPTALKER_AGENT_API_BASE(独立 Agent endpoint)及 PPTALKER_API_KEY。';
package/dist/index.js CHANGED
@@ -30,9 +30,9 @@ const RenderInput = z.object({
30
30
  .describe('按页排序的一页一条纯文本讲稿。所有来源(原生备注/用户提供/Agent 生成)都必须展示并明确确认;准备完成后用同一 id 和确认后的 notes 再提交。'),
31
31
  notes_confirmed: z.boolean().default(false).describe('默认 false;仅在用户明确确认本次逐页讲稿后设为 true。原生备注也不自动视为确认。'),
32
32
  language: z.string().min(2).max(20).optional().describe('讲稿语言,默认 PPTALKER_LANGUAGE 或 zh-CN。'),
33
- voice: z.string().max(80).optional().describe('使用 account 返回的 voice 名称或 ID。'),
33
+ voice: z.string().max(80).optional().describe('音色名称或 ID,可取 account 返回的 voices(标准音色)或 cloned_voices(克隆音色)。不传则用 PPTALKER_VOICE 或该语言默认音色。'),
34
34
  style: z.enum(['clean', 'bold']).optional(),
35
- speed: z.number().int().min(80).max(150).optional(),
35
+ speed: z.number().int().min(80).max(150).optional().describe('语速 80–150;不传则用 PPTALKER_SPEED(默认 100)。慢≈85,快≈120。'),
36
36
  video_title: z.string().max(200).optional().describe('视频标题;对应当前独立后端的 video_title 字段。'),
37
37
  is_public: z.boolean().default(false).describe('是否生成公开分享页;默认 false(私有,只给临时签名链接)。'),
38
38
  wait,
@@ -99,8 +99,10 @@ export async function handleRender(client, cfg, input, extra = {}) {
99
99
  method: 'POST', timeoutMs: Math.min(120000, remaining()), signal,
100
100
  body: { request_id: context.request_id, file_name: context.file_name,
101
101
  notes: input.notes, notes_confirmed: input.notes_confirmed === true,
102
- language: input.language || cfg.defaultLanguage, voice: input.voice,
103
- style: input.style || cfg.defaultStyle, speed: input.speed ?? 100,
102
+ language: input.language || cfg.defaultLanguage,
103
+ voice: input.voice || cfg.defaultVoice || undefined,
104
+ style: input.style || cfg.defaultStyle,
105
+ speed: input.speed ?? cfg.defaultSpeed ?? 100,
104
106
  video_title: input.video_title || '', is_public: input.is_public === true },
105
107
  }), Math.min(120000, remaining()), extra.signal);
106
108
  const result = normalizeTask(raw, { ...context, submission: 'accepted' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pptalker/agent",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "独立 PPTalker Agent MCP:异步准备、讲稿确认、私有视频与可取消的短状态查询。",
5
5
  "keywords": [
6
6
  "mcp",
Binary file
@@ -48,6 +48,8 @@ Key 从 https://www.pptalker.com/profile 获取,与网页端用的是同一个
48
48
  | `PPTALKER_API_KEY` | ✅ | — | `pptk_live_` 开头的 key |
49
49
  | `PPTALKER_LANGUAGE` | — | `zh-CN` | 默认旁白语言,可被单次调用覆盖 |
50
50
  | `PPTALKER_STYLE` | — | `clean` | `clean` 或 `bold` |
51
+ | `PPTALKER_VOICE` | — | 按语言取 | 全局默认音色。标准音色填名称或 ID,克隆音色填 `cloned_voices` 里的 `name` 或 `id` |
52
+ | `PPTALKER_SPEED` | — | `100` | 全局默认语速,整数 80–150 |
51
53
  | `PPTALKER_WAIT_SECONDS` | — | `30` | 仅 `wait=true` 时的客户端轮询预算,整数 10–45 |
52
54
  | `PPTALKER_OPERATION_SECONDS` | — | `180` | 单个新任务的总预算(上传 + 首次解析),整数 10–300 |
53
55
  | `PPTALKER_RECOVERY_DIR` | — | `~/.pptalker-agent/recovery/v2` | 本地恢复日志目录;填 `off` 关闭(关闭后中断任务只能靠用户自己记 id) |
@@ -90,6 +92,64 @@ Key 从 https://www.pptalker.com/profile 获取,与网页端用的是同一个
90
92
 
91
93
  无参数。返回剩余额度、套餐、可用音色、风格与限制,以及本地恢复记录 `last_tasks`(最多 50 条,不含 key 和 URL)。
92
94
 
95
+ ## 音色与语速(别让用户报 ID)
96
+
97
+ **默认不传 `voice`** —— 系统会按 `language` 取该语言的第一个音色。能出片就别多问一轮。
98
+
99
+ 用户想调整时按这个顺序处理:
100
+
101
+ 1. 只说"男声 / 女声" → 从 `pptalker_account` 同语言的音色里按 `Gender` 取第一个
102
+ 2. 说了具体名字(智菊、Joanna)→ 直接用对应的 `Id`
103
+ 3. 说不出想要什么 → 用默认,并顺带告诉他可以换
104
+
105
+ **中文音色(8 个)**
106
+
107
+ | 名称 | Id | 性别 |
108
+ |---|---|---|
109
+ | 智菊 | `501002` | 女(默认) |
110
+ | 智斌 | `501000` | 男 |
111
+ | 爱小静 | `601005` | 女 |
112
+ | 智小满 | `502004` | 女 |
113
+ | 爱小耀 | `601006` | 男 |
114
+ | 智小解 | `502005` | 男 |
115
+ | 爱小童 | `601015` | 男童 |
116
+ | 智小虎 | `502007` | 男童 |
117
+
118
+ 中文音色**没有在线试听页**,所以不要把它们描述成"温柔""沉稳""活泼"——没有依据。
119
+ 只说性别和是否儿童音色。觉得不合适就换一个再听。
120
+
121
+ 英文推荐 `Joanna`(女)、`Matthew`(男),样音见 AWS Polly 音色列表。
122
+ 其他常用:`Danielle`、`Kendra`(女),`Stephen`、`Joey`(男)。
123
+
124
+ ### 克隆音色(用户自己的声音)
125
+
126
+ **仅 Max 套餐可用。** `pptalker_account` 的 `cloned_voices` 返回:
127
+
128
+ ```json
129
+ [{"id": "cosyvoice-xxxx", "name": "我的声音", "source": "cosyvoice"}]
130
+ ```
131
+
132
+ 传 `voice` 时填 `name` 或 `id` 都行,后端会走 `cosyvoice` 合成。
133
+
134
+ 两个限制:
135
+
136
+ 1. 非 Max 账号传克隆音色,后端返回 `1010`(`PLAN_REQUIRED`),提示需要 Max。
137
+ 2. 克隆音色**不会**作为该语言的默认值 —— 不显式指定就永远用标准音色。
138
+ 这是刻意的:否则免费用户会被默认选中克隆音色,直接撞上限。
139
+
140
+ 用户说"用我克隆的 XX 声线"时,先从 `cloned_voices` 里找到对应项再传;找不到就说明他没有这个音色,
141
+ 不要凭 `voices` 列表猜。
142
+
143
+ **语速用语义,不要让用户报数字**
144
+
145
+ | 用户说 | 传 `speed` |
146
+ |---|---|
147
+ | 慢一点 | `85` |
148
+ | 不要改 | `100` |
149
+ | 快一点 | `120` |
150
+
151
+ 超过 130 明显赶;低于 80 会拉长视频时长,也就增加费用。
152
+
93
153
  ## 讲稿优先级(严格按顺序)
94
154
 
95
155
  **1. 用户已经给了讲稿 → 原样使用**