From 4dad5ea6c1fb9c1ec338d8063f98ca091d5fd1ab Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Thu, 8 May 2025 12:07:50 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=99=BA=E6=8E=A7=E5=8F=B0=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=99=BE=E5=BA=A6ASR=20=E4=BF=AE=E5=A4=8D:=E6=99=BA?= =?UTF-8?q?=E6=8E=A7=E5=8F=B0=E8=B1=86=E5=8C=85ASR=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E7=83=AD=E8=AF=8D=E5=BC=95=E5=8F=91=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/changelog/202505081146.sql | 43 +++++++++++++++++++ .../db/changelog/db.changelog-master.yaml | 9 +++- .../core/providers/asr/doubao.py | 4 +- 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 main/manager-api/src/main/resources/db/changelog/202505081146.sql diff --git a/main/manager-api/src/main/resources/db/changelog/202505081146.sql b/main/manager-api/src/main/resources/db/changelog/202505081146.sql new file mode 100644 index 00000000..fe7582f3 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202505081146.sql @@ -0,0 +1,43 @@ +-- 添加百度ASR模型配置 +delete from `ai_model_config` where `id` = 'ASR_BaiduASR'; +INSERT INTO `ai_model_config` VALUES ('ASR_BaiduASR', 'ASR', 'BaiduASR', '百度语音识别', 0, 1, '{\"type\": \"baidu\", \"app_id\": \"\", \"api_key\": \"\", \"secret_key\": \"\", \"dev_pid\": 1537, \"output_dir\": \"tmp/\"}', NULL, NULL, 7, NULL, NULL, NULL, NULL); + + +-- 添加百度ASR供应器 +delete from `ai_model_provider` where `id` = 'SYSTEM_ASR_BaiduASR'; +INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES +('SYSTEM_ASR_BaiduASR', 'ASR', 'baidu', '百度语音识别', '[{"key":"app_id","label":"应用AppID","type":"string"},{"key":"api_key","label":"API Key","type":"string"},{"key":"secret_key","label":"Secret Key","type":"string"},{"key":"dev_pid","label":"语言参数","type":"number"},{"key":"output_dir","label":"输出目录","type":"string"}]', 7, 1, NOW(), 1, NOW()); + + +-- 更新百度ASR配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.bce.baidu.com/ai-engine/old/#/ai/speech/app/list', +`remark` = '百度ASR配置说明: +1. 访问 https://console.bce.baidu.com/ai-engine/old/#/ai/speech/app/list +2. 创建新应用 +3. 获取AppID、API Key和Secret Key +4. 填入配置文件中 +查看资源额度:https://console.bce.baidu.com/ai-engine/old/#/ai/speech/overview/resource/list +语言参数说明:https://ai.baidu.com/ai-doc/SPEECH/0lbxfnc9b +' WHERE `id` = 'ASR_BaiduASR'; + +-- 更新豆包供应器字段 +update `ai_model_provider` set `fields` = +'[{"key":"appid","label":"应用ID","type":"string"},{"key":"access_token","label":"访问令牌","type":"string"},{"key":"cluster","label":"集群","type":"string"},{"key":"boosting_table_name","label":"热词文件名称","type":"string"},{"key":"correct_table_name","label":"替换词文件名称","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]' +where `id` = 'SYSTEM_ASR_DoubaoASR'; + +-- 更新豆包ASR配置说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://console.volcengine.com/speech/app', +`remark` = '豆包ASR配置说明: +1. 需要在火山引擎控制台创建应用并获取appid和access_token +2. 支持中文语音识别 +3. 需要网络连接 +4. 输出文件保存在tmp/目录 +申请步骤: +1. 访问 https://console.volcengine.com/speech/app +2. 创建新应用 +3. 获取appid和access_token +4. 填入配置文件中 +如需设置热词,请参考:https://www.volcengine.com/docs/6561/155738 +' WHERE `id` = 'ASR_DoubaoASR'; \ No newline at end of file diff --git a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml index ffbef2ce..2936aed7 100755 --- a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml @@ -99,4 +99,11 @@ databaseChangeLog: changes: - sqlFile: encoding: utf8 - path: classpath:db/changelog/202505022134.sql \ No newline at end of file + path: classpath:db/changelog/202505022134.sql + - changeSet: + id: 202505081146 + author: hrz + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202505081146.sql \ No newline at end of file diff --git a/main/xiaozhi-server/core/providers/asr/doubao.py b/main/xiaozhi-server/core/providers/asr/doubao.py index 0775c2ab..18e64a9b 100644 --- a/main/xiaozhi-server/core/providers/asr/doubao.py +++ b/main/xiaozhi-server/core/providers/asr/doubao.py @@ -88,8 +88,8 @@ class ASRProvider(ASRProviderBase): self.appid = config.get("appid") self.cluster = config.get("cluster") self.access_token = config.get("access_token") - self.boosting_table_name = config.get("boosting_table_name") - self.correct_table_name = config.get("correct_table_name") + self.boosting_table_name = config.get("boosting_table_name", "") + self.correct_table_name = config.get("correct_table_name", "") self.output_dir = config.get("output_dir") self.delete_audio_file = delete_audio_file