From 4dbc54fa15ff77b7acda570cc494f8fef6a87a42 Mon Sep 17 00:00:00 2001 From: SSMario Date: Tue, 16 May 2023 12:00:05 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=20=E5=A2=9E=E5=8A=A0eleventLabs?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1d4ff796d79a49cd173e27121a365d7925305932. --- config.py | 2 +- requirements-optional.txt | 1 - voice/elevent/elevent_voice.py | 32 -------------------------------- voice/factory.py | 4 ---- 4 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 voice/elevent/elevent_voice.py diff --git a/config.py b/config.py index 782beac..ae1cfd7 100644 --- a/config.py +++ b/config.py @@ -53,7 +53,7 @@ available_setting = { "voice_reply_voice": False, # 是否使用语音回复语音,需要设置对应语音合成引擎的api key "always_reply_voice": False, # 是否一直使用语音回复 "voice_to_text": "openai", # 语音识别引擎,支持openai,baidu,google,azure - "text_to_voice": "baidu", # 语音合成引擎,支持baidu,google,pytts(offline),azure,eleven + "text_to_voice": "baidu", # 语音合成引擎,支持baidu,google,pytts(offline),azure # baidu 语音api配置, 使用百度语音识别和语音合成时需要 "baidu_app_id": "", "baidu_api_key": "", diff --git a/requirements-optional.txt b/requirements-optional.txt index 9901de4..c248689 100644 --- a/requirements-optional.txt +++ b/requirements-optional.txt @@ -9,7 +9,6 @@ baidu_aip>=4.16.10 # baidu voice azure-cognitiveservices-speech # azure voice numpy<=1.24.2 langid # language detect -elevenlabs==0.2.15 #install plugin dulwich diff --git a/voice/elevent/elevent_voice.py b/voice/elevent/elevent_voice.py deleted file mode 100644 index 72d5bcd..0000000 --- a/voice/elevent/elevent_voice.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -eleventLabs voice service -""" - -import time - -from elevenlabs import generate - -from bridge.reply import Reply, ReplyType -from common.log import logger -from common.tmp_dir import TmpDir -from voice.voice import Voice - - -class ElevenLabsVoice(Voice): - - def __init__(self): - pass - - def voiceToText(self, voice_file): - pass - - def textToVoice(self, text): - audio = generate( - text=text - ) - fileName = TmpDir().path() + "reply-" + str(int(time.time())) + "-" + str(hash(text) & 0x7FFFFFFF) + ".mp3" - with open(fileName, "wb") as f: - f.write(audio) - logger.info("[ElevenLabs] textToVoice text={} voice file name={}".format(text, fileName)) - return Reply(ReplyType.VOICE, fileName) - diff --git a/voice/factory.py b/voice/factory.py index 0cf1a05..45fe0d1 100644 --- a/voice/factory.py +++ b/voice/factory.py @@ -29,8 +29,4 @@ def create_voice(voice_type): from voice.azure.azure_voice import AzureVoice return AzureVoice() - elif voice_type == "eleven": - from voice.elevent.elevent_voice import ElevenLabsVoice - - return ElevenLabsVoice() raise RuntimeError