From effcceb44b4f281008c7823910b8370d2dba1134 Mon Sep 17 00:00:00 2001 From: lanhao Date: Thu, 2 Jul 2026 23:58:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Fish=20Audio=E8=B5=B0=E4=B8=9C=E4=BA=ACV?= =?UTF-8?q?PS=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=9B=BD=E5=86=85=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=9B=B4=E8=BF=9E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- backend/app/services/fish_audio_service.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/app/services/fish_audio_service.py b/backend/app/services/fish_audio_service.py index 5bde26d..f97a821 100644 --- a/backend/app/services/fish_audio_service.py +++ b/backend/app/services/fish_audio_service.py @@ -2,6 +2,11 @@ import os import requests +PROXY_URL = 'http://202.182.125.133:8443/fish-api/v1/tts' +PROXY_USER = 'fishproxy' +PROXY_PASS = 'AO7C6SiovkRydkSHsUPJaOZw0CBh9mp0' + + def synthesize_fish_audio(text, speed=1.0, pitch=0, volume=1.0, emotion='neutral'): api_key = os.getenv('FISH_AUDIO_API_KEY', '') if not api_key: @@ -20,9 +25,8 @@ def synthesize_fish_audio(text, speed=1.0, pitch=0, volume=1.0, emotion='neutral if tag: text = f"{tag}{text}" - url = 'https://api.fish.audio/v1/tts' headers = { - 'Authorization': f'Bearer {api_key}', + 'X-Fish-Auth': f'Bearer {api_key}', 'Content-Type': 'application/json' } @@ -34,7 +38,10 @@ def synthesize_fish_audio(text, speed=1.0, pitch=0, volume=1.0, emotion='neutral 'volume': max(-20, min(20, (volume - 1.0) * 20)), } - response = requests.post(url, json=payload, headers=headers, timeout=60, stream=True) + response = requests.post( + PROXY_URL, json=payload, headers=headers, + auth=(PROXY_USER, PROXY_PASS), timeout=120 + ) if response.status_code != 200: raise Exception(f'Fish Audio API错误: {response.status_code} - {response.text[:200]}')