diff --git a/Dockerfile b/Dockerfile index 7ee3c6f1f..c217ad7a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,13 +19,12 @@ RUN apt update && \ apt install -y ffmpeg && \ pip install pdm -VOLUME ["/redis", "/rabbitmq", "/mongodb", "/run.log", "/config_dir"] +VOLUME ["/redis", "/rabbitmq", "/mongodb", "/run.log", ".cache",".montydb",".snapshot"] WORKDIR /app COPY --from=builder /project/.venv /app/.venv COPY pm2.json ./ -COPY config_dir ./config_dir COPY . /app CMD [ "pm2-runtime", "pm2.json" ] diff --git a/llmkira/extra/voice/__init__.py b/llmkira/extra/voice/__init__.py index 5fa269113..3ce6893c3 100644 --- a/llmkira/extra/voice/__init__.py +++ b/llmkira/extra/voice/__init__.py @@ -1,6 +1,7 @@ import base64 import json from io import BytesIO +from typing import Optional import aiohttp import edge_tts @@ -49,7 +50,8 @@ def get_audio_bytes_from_data_url(data_url): audio_base64 = data_url.split(",")[1] audio_bytes = base64.b64decode(audio_base64) return audio_bytes - except Exception: + except Exception as e: + logger.warning(f"Failed to extract audio bytes: {e}") return None @@ -143,7 +145,7 @@ async def request_novelai_speech(text): return None -async def request_cn(text, reecho_api_key: str = None): +async def request_cn(text, reecho_api_key: str = None) -> Optional[bytes]: """ Call the Reecho endpoint to generate synthesized voice. :param text: The text to synthesize @@ -156,9 +158,10 @@ async def request_cn(text, reecho_api_key: str = None): stt = await request_reecho_speech(text, reecho_api_key) if not stt: return await request_dui_speech(text) + return stt -async def request_en(text): +async def request_en(text) -> Optional[bytes]: """ Call the Reecho endpoint to generate synthesized voice. :param text: The text to synthesize