This repository has been archived on 2026-08-12. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Cyrene/backend/voice-service/internal/config/config.go
T
AskaEth b1e89c606e feat: Phase 5 STT — DashScope Gummy 实时语音识别 + 本地 Whisper 回退
- DashScope WebSocket STT 客户端 (gummy-chat-v1)
- 双引擎架构: DashScope 优先, Whisper 本地回退
- 实时流式 STT WebSocket 端点
- DevTools 模型搜索框焦点修复

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 22:15:43 +08:00

37 lines
897 B
Go

package config
import "os"
// Config STT 语音识别服务配置
type Config struct {
Port string
WhisperBinary string
WhisperModel string
WhisperLanguage string
MaxAudioSize int64 // 字节
// DashScope STT 配置
DashScopeAPIKey string
DashScopeModel string
}
// Load 从环境变量加载配置
func Load() *Config {
return &Config{
Port: getEnv("PORT", "8093"),
WhisperBinary: getEnv("WHISPER_BINARY", "./whisper.cpp/main"),
WhisperModel: getEnv("WHISPER_MODEL", "./whisper.cpp/models/ggml-small.bin"),
WhisperLanguage: getEnv("WHISPER_LANGUAGE", "zh"),
MaxAudioSize: 10 * 1024 * 1024, // 10MB
DashScopeAPIKey: getEnv("DASHSCOPE_API_KEY", ""),
DashScopeModel: getEnv("DASHSCOPE_STT_MODEL", "gummy-chat-v1"),
}
}
func getEnv(key, fallback string) string {
if v := os.Getenv(key); v != "" {
return v
}
return fallback
}