增加了enable_asr配置选项,更改一处潜在的bug
This commit is contained in:
@@ -11,6 +11,9 @@ logger = get_logger("chat_voice")
|
||||
|
||||
async def get_voice_text(voice_base64: str) -> str:
|
||||
"""获取音频文件描述"""
|
||||
if not global_config.chat.enable_asr:
|
||||
logger.warning("语音识别未启用,无法处理语音消息")
|
||||
return "[语音]"
|
||||
try:
|
||||
# 解码base64音频数据
|
||||
# 确保base64字符串只包含ASCII字符
|
||||
|
||||
@@ -106,6 +106,9 @@ class ChatConfig(ConfigBase):
|
||||
focus_value: float = 1.0
|
||||
"""麦麦的专注思考能力,越低越容易专注,消耗token也越多"""
|
||||
|
||||
enable_asr: bool = False
|
||||
"""是否启用语音识别"""
|
||||
|
||||
def get_current_talk_frequency(self, chat_stream_id: Optional[str] = None) -> float:
|
||||
"""
|
||||
根据当前时间和聊天流获取对应的 talk_frequency
|
||||
|
||||
@@ -684,7 +684,7 @@ class LLMRequest:
|
||||
data.add_field(
|
||||
"file",io.BytesIO(file_bytes),
|
||||
filename=f"file.{file_format}",
|
||||
content_type=f'{content_type_list[file_format]}' # 根据实际文件类型设置
|
||||
content_type=f'{content_type}' # 根据实际文件类型设置
|
||||
)
|
||||
data.add_field(
|
||||
"model", self.model_name
|
||||
|
||||
@@ -87,6 +87,7 @@ talk_frequency_adjust = [
|
||||
# - 时间支持跨天,例如 "00:10,0.3" 表示从凌晨0:10开始使用频率0.3
|
||||
# - 系统会自动将 "platform:id:type" 转换为内部的哈希chat_id进行匹配
|
||||
|
||||
enable_asr = false # 是否启用语音识别,启用后麦麦可以通过语音输入进行对话,启用该功能需要配置语音识别模型[model.voice]
|
||||
|
||||
[message_receive]
|
||||
# 以下是消息过滤,可以根据规则过滤特定消息,将不会读取这些消息
|
||||
|
||||
Reference in New Issue
Block a user