Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c8d1e676c |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,6 +13,9 @@ from fastapi.staticfiles import StaticFiles
|
|||||||
# 导入后端服务
|
# 导入后端服务
|
||||||
from server import app as api_app
|
from server import app as api_app
|
||||||
|
|
||||||
|
# 确保音频缓存目录存在
|
||||||
|
os.makedirs("audio_cache", exist_ok=True)
|
||||||
|
|
||||||
# 主应用
|
# 主应用
|
||||||
app = FastAPI(title="Voice Chat Web")
|
app = FastAPI(title="Voice Chat Web")
|
||||||
|
|
||||||
@@ -51,6 +54,9 @@ async def proxy_chattts_audio(filename: str):
|
|||||||
return Response(content=f'{"detail":"{str(e)}"}'.encode(), status_code=500, media_type="application/json")
|
return Response(content=f'{"detail":"{str(e)}"}'.encode(), status_code=500, media_type="application/json")
|
||||||
|
|
||||||
|
|
||||||
|
# 挂载音频文件目录(Edge TTS 生成的 MP3)
|
||||||
|
app.mount("/audio", StaticFiles(directory="audio_cache"), name="audio")
|
||||||
|
|
||||||
# 挂载 API
|
# 挂载 API
|
||||||
app.mount("/api", api_app)
|
app.mount("/api", api_app)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user