紧急更新

1、删除意外出的语音合成开关;
2、唤醒、麦克风、扬声器可以启动后开启和关闭。
This commit is contained in:
guo zebin 2024-11-01 09:18:19 +08:00
parent c31193e28f
commit 10d419e1e6
5 changed files with 28 additions and 25 deletions

View File

@ -315,7 +315,6 @@ class FeiFei:
def say(self, interact, text): def say(self, interact, text):
try: try:
result = None result = None
if config_util.config["interact"]["sound_synthesis_enabled"]:
audio_url = interact.data.get('audio')#透传的音频 audio_url = interact.data.get('audio')#透传的音频
if audio_url is not None: if audio_url is not None:
file_name = 'sample-' + str(int(time.time() * 1000)) + '.wav' file_name = 'sample-' + str(int(time.time() * 1000)) + '.wav'

View File

@ -201,6 +201,10 @@ class Recorder:
audio_data_list = [] audio_data_list = []
while self.__running: while self.__running:
try: try:
record = cfg.config['source']['record']
if not record['enabled']:
time.sleep(0.1)
continue
self.is_reading = True self.is_reading = True
data = stream.read(1024, exception_on_overflow=False) data = stream.read(1024, exception_on_overflow=False)
self.is_reading = False self.is_reading = False

View File

@ -48,6 +48,13 @@ class RecorderListener(Recorder):
def get_stream(self): def get_stream(self):
try: try:
#是否录音的控制是放在recorder.py的这里的作用是防止没有麦克风的设备出错
while True:
record = config_util.config['source']['record']
if record['enabled']:
break
time.sleep(0.1)
self.paudio = pyaudio.PyAudio() self.paudio = pyaudio.PyAudio()
device_id = 0 # 或者根据需要选择其他设备 device_id = 0 # 或者根据需要选择其他设备
@ -221,7 +228,7 @@ def kill_process_by_port(port):
except(psutil.NosuchProcess, psutil.AccessDenied): except(psutil.NosuchProcess, psutil.AccessDenied):
pass pass
#数字人端请求获取最新的自动播放消息,若自动播放服务关闭会自动退出自动播放 #数字人端请求获取最新的自动播放消息,若自动播放服务关闭会自动退出自动播放
def start_auto_play_service(): def start_auto_play_service(): #TODO 评估一下有无优化的空间
url = f"{config_util.config['source']['automatic_player_url']}/get_auto_play_item" url = f"{config_util.config['source']['automatic_player_url']}/get_auto_play_item"
user = "User" #TODO 临时固死了 user = "User" #TODO 临时固死了
is_auto_server_error = False is_auto_server_error = False

View File

@ -137,7 +137,6 @@ new Vue({
visualization_detection_enabled: false, visualization_detection_enabled: false,
source_record_enabled: false, source_record_enabled: false,
source_record_device: '', source_record_device: '',
sound_synthesis_enabled: true,
attribute_name: "", attribute_name: "",
attribute_gender: "", attribute_gender: "",
attribute_age: "", attribute_age: "",
@ -211,7 +210,6 @@ new Vue({
if (config.interact) { if (config.interact) {
this.play_sound_enabled = config.interact.playSound; this.play_sound_enabled = config.interact.playSound;
this.visualization_detection_enabled = config.interact.visualization; this.visualization_detection_enabled = config.interact.visualization;
this.sound_synthesis_enabled = config.interact.sound_synthesis_enabled;
this.QnA = config.interact.QnA; this.QnA = config.interact.QnA;
} }
if (config.source && config.source.record) { if (config.source && config.source.record) {
@ -277,7 +275,6 @@ new Vue({
}, },
"interact": { "interact": {
"playSound": this.play_sound_enabled, "playSound": this.play_sound_enabled,
"sound_synthesis_enabled": this.sound_synthesis_enabled,
"visualization": this.visualization_detection_enabled, "visualization": this.visualization_detection_enabled,
"QnA": this.QnA, "QnA": this.QnA,
"maxInteractTime": this.interact_maxInteractTime, "maxInteractTime": this.interact_maxInteractTime,

View File

@ -55,7 +55,7 @@
<div class="setting_wakeup"> <div class="setting_wakeup">
<ul> <ul>
<li> <span class="font_name">唤醒模式:</span> <li> <span class="font_name">唤醒模式:</span>
<el-switch :disabled="!configEditable" <el-switch @change=saveConfig()
v-model="wake_word_enabled" v-model="wake_word_enabled"
active-color="#13ce66" active-color="#13ce66"
inactive-color="#ff4949"> inactive-color="#ff4949">
@ -74,12 +74,12 @@
<div class="microphone"> <div class="microphone">
<div class="microphone_group1"> <div class="microphone_group1">
<span class="font_name">&nbsp;&nbsp;&nbsp;:</span> <span class="font_name">服务器扬声器</span>
<el-switch v-model="play_sound_enabled" active-color="#13ce66" inactive-color="#ff4949" :disabled="!configEditable"> </el-switch> <el-switch v-model="play_sound_enabled" active-color="#13ce66" inactive-color="#ff4949" @change=saveConfig()> </el-switch>
</div> </div>
<div class="microphone_group1" > <div class="microphone_group1" >
<span class="font_name">&nbsp;&nbsp;&nbsp;&nbsp;:</span> <span class="font_name">服务器麦克风</span>
<el-switch v-model="source_record_enabled" active-color="#13ce66" inactive-color="#ff4949" :disabled="!configEditable"> </el-switch> <el-switch v-model="source_record_enabled" active-color="#13ce66" inactive-color="#ff4949" @change=saveConfig()> </el-switch>
</div> </div>
</div> </div>
<div class="setting_wakeup"> <div class="setting_wakeup">
@ -90,10 +90,6 @@
:label="item.label" :value="item.value"> :label="item.label" :value="item.value">
</option> </option>
</select></li> </select></li>
<li>
<span class="font_name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</span>
<el-switch v-model="sound_synthesis_enabled" active-color="#13ce66" inactive-color="#ff4949" :disabled="!configEditable"> </el-switch>
</li>
<li style="display: flex;"> <span class="font_name" style="line-height: 36px;">&nbsp;&nbsp;&nbsp;&nbsp;:</span> <li style="display: flex;"> <span class="font_name" style="line-height: 36px;">&nbsp;&nbsp;&nbsp;&nbsp;:</span>
<el-slider style="width: 230px;" v-model="interact_perception_follow" :disabled="!configEditable"></el-slider></li> <el-slider style="width: 230px;" v-model="interact_perception_follow" :disabled="!configEditable"></el-slider></li>
</ul> </ul>