Fix
This commit is contained in:
@ -30,7 +30,6 @@ export async function generateTTS(
|
|||||||
const queryUrl = `${config.voicevox.host}/audio_query?text=${encodedText}&speaker=${defaultVoiceStyle.styleId}`;
|
const queryUrl = `${config.voicevox.host}/audio_query?text=${encodedText}&speaker=${defaultVoiceStyle.styleId}`;
|
||||||
const synthesisUrl = `${config.voicevox.host}/synthesis?speaker=${defaultVoiceStyle.styleId}`;
|
const synthesisUrl = `${config.voicevox.host}/synthesis?speaker=${defaultVoiceStyle.styleId}`;
|
||||||
|
|
||||||
try {
|
|
||||||
const queryResponse = await fetch(queryUrl, {
|
const queryResponse = await fetch(queryUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -55,7 +54,7 @@ export async function generateTTS(
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify(audioQuery),
|
body: JSON.stringify(audioQuery),
|
||||||
signal: AbortSignal.timeout(10000000), // タイムアウトを10分に設定
|
signal: AbortSignal.timeout(600000), // 10分のタイムアウト
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!audioResponse.ok) {
|
if (!audioResponse.ok) {
|
||||||
@ -114,10 +113,4 @@ export async function generateTTS(
|
|||||||
console.log(`TTS生成完了: ${itemId}`);
|
console.log(`TTS生成完了: ${itemId}`);
|
||||||
|
|
||||||
return path.basename(mp3FilePath);
|
return path.basename(mp3FilePath);
|
||||||
} catch (error) {
|
|
||||||
console.error("Error generating TTS:", error);
|
|
||||||
throw new Error(
|
|
||||||
`Failed to generate TTS: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user