From dd664b65993e9bf3ca4fd2f5c4dcfc0d0b76c5e8 Mon Sep 17 00:00:00 2001 From: sudoskys Date: Thu, 18 Apr 2024 20:26:41 +0800 Subject: [PATCH 1/3] :art: chore(Dockerfile): update volume paths in Dockerfile Update volume paths in Dockerfile to include additional directories. --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7ee3c6f1..c217ad7a 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" ] From c519189eebc1fd26379fe4a1a8d8dc2d01de7828 Mon Sep 17 00:00:00 2001 From: sudoskys Date: Thu, 18 Apr 2024 20:35:24 +0800 Subject: [PATCH 2/3] :recycle: refactor: fix indentation issues in voice module files --- llmkira/extra/voice/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llmkira/extra/voice/__init__.py b/llmkira/extra/voice/__init__.py index 5fa26911..967e2951 100644 --- a/llmkira/extra/voice/__init__.py +++ b/llmkira/extra/voice/__init__.py @@ -49,7 +49,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 @@ -156,6 +157,7 @@ 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): From 80a4e0b25f4feb59b4c39a3109d87f95d218630b Mon Sep 17 00:00:00 2001 From: sudoskys Date: Thu, 18 Apr 2024 20:35:50 +0800 Subject: [PATCH 3/3] :recycle: refactor: fix indentation issues in voice module files --- llmkira/extra/voice/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llmkira/extra/voice/__init__.py b/llmkira/extra/voice/__init__.py index 967e2951..3ce6893c 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 @@ -144,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 @@ -160,7 +161,7 @@ async def request_cn(text, reecho_api_key: str = None): 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