You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
1、app.py
|
|
from core.utils.mysql_util import init_mysql_pool, close_mysql_pool
|
|
|
|
# 加载配置
|
|
config = load_config()
|
|
|
|
# 【黄海】初始化 MySQL 连接池
|
|
await init_mysql_pool()
|
|
|
|
...
|
|
|
|
finally:
|
|
ws_task.cancel()
|
|
try:
|
|
await ws_task
|
|
except asyncio.CancelledError:
|
|
pass
|
|
# 关闭 MySQL 连接池
|
|
await close_mysql_pool()
|
|
print("服务器已关闭,程序退出。")
|
|
|
|
2、D:\dsWork\QingLong\XiaoZhi\xiaozhi-esp32-server\main\xiaozhi-server\core\providers\asr\fun_local.py
|
|
|
|
text = rich_transcription_postprocess(result[0]["text"])
|
|
logger.bind(tag=TAG).info(f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text}")
|
|
|
|
#【黄海注释】准备在这里进行嵌入代码,把文字+声音的关系记录下来,让用户选择是哪个人进行声纹匹配
|
|
# 保存聊天记录
|
|
await save_chat_history(
|
|
chat_text=text,
|
|
chat_wav=file_path,
|
|
ai_text='',# 暂时没有记录AI的影响
|
|
person_id="FDE43080-122E-4F5D-B860-4E53DEC54BFB",
|
|
person_name='黄海'
|
|
)
|
|
return text, file_path
|