mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
@@ -0,0 +1,19 @@
|
|||||||
|
-- Add language configuration for local FunASR ASR.
|
||||||
|
UPDATE `ai_model_provider`
|
||||||
|
SET `fields` = '[{"key":"model_dir","label":"模型目录","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"language","label":"识别语言","type":"string","default":"auto"}]'
|
||||||
|
WHERE `id` = 'SYSTEM_ASR_FunASR';
|
||||||
|
|
||||||
|
UPDATE `ai_model_config`
|
||||||
|
SET `config_json` = JSON_SET(`config_json`, '$.language', 'auto')
|
||||||
|
WHERE `id` = 'ASR_FunASR'
|
||||||
|
AND JSON_EXTRACT(`config_json`, '$.language') IS NULL;
|
||||||
|
|
||||||
|
-- Update the FunASR local model configuration description to mention the language option.
|
||||||
|
UPDATE `ai_model_config`
|
||||||
|
SET `remark` = 'FunASR本地模型配置说明:
|
||||||
|
1. 需要下载模型文件到xiaozhi-server/models/SenseVoiceSmall目录
|
||||||
|
2. 支持中日韩粤语音识别
|
||||||
|
3. 本地推理,无需网络连接
|
||||||
|
4. 待识别文件保存在tmp/目录
|
||||||
|
5. “识别语言”字段控制识别语种:auto = 自动检测;如需限定只识别中文可设为 zh(en=英语、ja=日语、ko=韩语、yue=粤语)。'
|
||||||
|
WHERE `id` = 'ASR_FunASR';
|
||||||
Executable → Regular
+7
@@ -690,3 +690,10 @@ databaseChangeLog:
|
|||||||
- sqlFile:
|
- sqlFile:
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
path: classpath:db/changelog/202606261131.sql
|
path: classpath:db/changelog/202606261131.sql
|
||||||
|
- changeSet:
|
||||||
|
id: 202607011405
|
||||||
|
author: LauraGPT
|
||||||
|
changes:
|
||||||
|
- sqlFile:
|
||||||
|
encoding: utf8
|
||||||
|
path: classpath:db/changelog/202607011405.sql
|
||||||
|
|||||||
@@ -360,6 +360,9 @@ ASR:
|
|||||||
type: fun_local
|
type: fun_local
|
||||||
model_dir: models/SenseVoiceSmall
|
model_dir: models/SenseVoiceSmall
|
||||||
output_dir: tmp/
|
output_dir: tmp/
|
||||||
|
# 识别语种:auto 自动检测;如需限制只识别中文可设为 zh,避免中文短句误判为韩文等。
|
||||||
|
# SenseVoice 支持 zh、en、ja、ko、yue 等语种标记。
|
||||||
|
language: auto
|
||||||
FunASRServer:
|
FunASRServer:
|
||||||
# 独立部署FunASR,使用FunASR的API服务,只需要五句话
|
# 独立部署FunASR,使用FunASR的API服务,只需要五句话
|
||||||
# 第一句:mkdir -p ./funasr-runtime-resources/models
|
# 第一句:mkdir -p ./funasr-runtime-resources/models
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class ASRProvider(ASRProviderBase):
|
|||||||
self.interface_type = InterfaceType.LOCAL
|
self.interface_type = InterfaceType.LOCAL
|
||||||
self.model_dir = config.get("model_dir")
|
self.model_dir = config.get("model_dir")
|
||||||
self.output_dir = config.get("output_dir") # 修正配置键名
|
self.output_dir = config.get("output_dir") # 修正配置键名
|
||||||
|
self.language = config.get("language", "auto")
|
||||||
self.delete_audio_file = delete_audio_file
|
self.delete_audio_file = delete_audio_file
|
||||||
|
|
||||||
# 确保输出目录存在
|
# 确保输出目录存在
|
||||||
@@ -80,7 +81,7 @@ class ASRProvider(ASRProviderBase):
|
|||||||
self.model.generate,
|
self.model.generate,
|
||||||
input=artifacts.pcm_bytes,
|
input=artifacts.pcm_bytes,
|
||||||
cache={},
|
cache={},
|
||||||
language="auto",
|
language=self.language,
|
||||||
use_itn=True,
|
use_itn=True,
|
||||||
batch_size_s=60,
|
batch_size_s=60,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user