mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 19:00:45 +00:00
fix(minimax): normalize tts pitch for api
This commit is contained in:
@@ -309,7 +309,13 @@ describe("buildMinimaxSpeechProvider", () => {
|
||||
text: "Test",
|
||||
cfg: {} as never,
|
||||
providerConfig: { apiKey: "sk-test" },
|
||||
providerOverrides: { model: "speech-01-240228", voiceId: "custom_voice", speed: 1.5 },
|
||||
providerOverrides: {
|
||||
model: "speech-01-240228",
|
||||
voiceId: "custom_voice",
|
||||
speed: 1.5,
|
||||
vol: 1.5,
|
||||
pitch: 0.5,
|
||||
},
|
||||
target: "audio-file",
|
||||
timeoutMs: 30000,
|
||||
});
|
||||
@@ -318,6 +324,8 @@ describe("buildMinimaxSpeechProvider", () => {
|
||||
expect(body.model).toBe("speech-01-240228");
|
||||
expect(body.voice_setting.voice_id).toBe("custom_voice");
|
||||
expect(body.voice_setting.speed).toBe(1.5);
|
||||
expect(body.voice_setting.vol).toBe(1.5);
|
||||
expect(body.voice_setting.pitch).toBe(0);
|
||||
});
|
||||
|
||||
it("throws when API key is missing", async () => {
|
||||
|
||||
@@ -24,6 +24,10 @@ export function normalizeMinimaxTtsBaseUrl(baseUrl?: string): string {
|
||||
return trimmed.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
function normalizeMinimaxTtsPitch(pitch: number): number {
|
||||
return Math.trunc(pitch);
|
||||
}
|
||||
|
||||
export async function minimaxTTS(params: {
|
||||
text: string;
|
||||
apiKey: string;
|
||||
@@ -70,7 +74,7 @@ export async function minimaxTTS(params: {
|
||||
voice_id: voiceId,
|
||||
speed,
|
||||
vol,
|
||||
pitch,
|
||||
pitch: normalizeMinimaxTtsPitch(pitch),
|
||||
},
|
||||
audio_setting: {
|
||||
format,
|
||||
|
||||
Reference in New Issue
Block a user