feat: 添加 Xiaomi MiMo ASR 语音识别提供者
- 新增 MiMoService 实现 stt.Service 接口,通过 HTTP POST 调用 OpenAI 兼容的 /chat/completions 接口 - 自动将原始 PCM 数据封装为 WAV 格式(MiMo 仅支持 mp3/wav) - 语言代码映射:zh-CN→zh、en-US→en、其他→auto - main.go 添加 provider 选择逻辑(mimo/xiaomi → MiMo,其他 → Deepgram) - 更新 config.yaml 使用正确的 model 名称 mimo-v2.5-asr - 添加完整单元测试
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -46,7 +47,13 @@ func main() {
|
||||
defer sessionMgr.(*session.MemoryManager).Stop()
|
||||
|
||||
// 初始化 AI 服务
|
||||
sttService := stt.NewDeepgramService(cfg.AI.STT.APIKey, cfg.AI.STT.Model, cfg.AI.STT.Endpoint, logger.Log)
|
||||
var sttService stt.Service
|
||||
switch strings.ToLower(cfg.AI.STT.Provider) {
|
||||
case "mimo", "xiaomi":
|
||||
sttService = stt.NewMiMoService(cfg.AI.STT.APIKey, cfg.AI.STT.Model, cfg.AI.STT.Endpoint, logger.Log)
|
||||
default:
|
||||
sttService = stt.NewDeepgramService(cfg.AI.STT.APIKey, cfg.AI.STT.Model, cfg.AI.STT.Endpoint, logger.Log)
|
||||
}
|
||||
llmService := llm.NewOpenAIService(cfg.AI.LLM.APIKey, cfg.AI.LLM.Model, cfg.AI.LLM.Endpoint, cfg.AI.LLM.Timeout, logger.Log)
|
||||
ttsService := tts.NewOpenAIService(cfg.AI.TTS.APIKey, cfg.AI.TTS.Model, cfg.AI.TTS.Voice, cfg.AI.TTS.Endpoint, cfg.AI.TTS.Speed, cfg.AI.TTS.Timeout, logger.Log)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user