feat: use pure direct connection to official api.fish.audio without any forced proxies

This commit is contained in:
2026-08-01 17:55:30 +08:00
parent b8aee4d766
commit 3ecae7b0bc
+3 -13
View File
@@ -2493,25 +2493,15 @@ app.post('/api/tts/generate', express.json(), async (req, res) => {
body: requestBody body: requestBody
}; };
// Always try to use local proxy first if we are on a Windows machine
if (!proxyUrl && os.platform() === 'win32') {
proxyUrl = 'http://127.0.0.1:7890';
}
let response; let response;
try { try {
response = proxyUrl response = proxyUrl
? await requestViaProxy('https://fishaudio.fse-media.group/v1/tts', options, proxyUrl) ? await requestViaProxy('https://api.fish.audio/v1/tts', options, proxyUrl)
: await requestDirect('https://fishaudio.fse-media.group/v1/tts', options); : await requestDirect('https://api.fish.audio/v1/tts', options);
} catch (e) { } catch (e) {
// Fallback for Windows if local proxy fails console.log(`[TTS] Direct connection failed: ${e.message}`);
if (os.platform() === 'win32' && proxyUrl === 'http://127.0.0.1:7890') {
console.log(`[TTS] Local proxy failed, attempting direct connection...`);
response = await requestDirect('https://fishaudio.fse-media.group/v1/tts', options);
} else {
throw e; throw e;
} }
}
if (!response.ok) { if (!response.ok) {
const msg = (response.text && String(response.text).trim().length > 0) const msg = (response.text && String(response.text).trim().length > 0)