Repository navigation
feat(#646): add --speed to podcast and TTS commands - #26
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes part of marswaveai/listenhub-ralph#646
做了什么
播客与 TTS 的创建命令(站内和 OpenAPI 两套)都加了
--speed <multiplier>:生成语速倍率 0.5–2.0,最多两位小数,不传等价于 1.0×。podcast create、tts createopenapi podcast create、openapi podcast generate-audio、openapi flow-speech create、openapi flow-speech tts、openapi tts、openapi audio-speech、openapi speech新增
source/_shared/speed.ts作为 commander 的 option parser:越界、超两位小数、非数字都抛InvalidArgumentError,不静默修正成用户没请求过的语速。中英文 README 各加了一条 1.25× 的示例。验证证据
CLI 依赖已发布的
@marswave/listenhub-sdk@^0.0.20,其类型里还没有speed,所以直接跑pnpm check会报 9 个TS2353: 'speed' does not exist in type ...。为了拿到真实证据,临时用pnpm.overrides把 SDK 指向本地构建(link:/workspace/listenhub-sdk,即配套 SDK PR 的产物)跑完全套,验证后已把package.json与pnpm-lock.yaml还原到 tracked 状态,本 PR 不含任何 link 改动。新增
tests/speed.test.ts(5 个用例):快捷值与边界原样通过、非快捷值 0.85 / 1.35 通过、越界不 clamp 而是报错、超两位小数不四舍五入而是报错、非数字报错。--help实测:参数校验实测:
阻塞项
本 PR 的 CI 会因为类型错误报红,直到配套的 SDK PR 合并并发版、CLI 的依赖版本随之抬起来。 这是 SDK → CLI 的固有先后顺序,不是本 PR 的缺陷;上面的证据是在本地 SDK 构建下取的。合并顺序:SDK PR → 发版 → 抬 CLI 的
@marswave/listenhub-sdk版本 → 合并本 PR。实现期假设
--speed不设默认值:commander 不给默认,未传时options.speed === undefined,请求体里就没有speed键,行为与改动前完全一致。Math.round(speed * 100) !== speed * 100:与 api-server 的Joi.precision(2)同口径。Number('')是 0,会被误判成范围错误,所以 parser 先把空白输入当作非数字处理,错误信息才准确。openapi podcast generate-audio只在传了--speed时才带 body(否则维持原来的空 body 调用)。风险判定
快车道(0 个独立 reviewer):
route-gates.py参考信号risk=normal、reasons=[]、nonDowngradable=false,与人工判断一致。改动是纯增量 flag,不传就走原路径。Generated by Claude Code