package config import "os" // Config STT 语音识别服务配置 type Config struct { Port string WhisperBinary string WhisperModel string WhisperLanguage string MaxAudioSize int64 // 字节 } // 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 } } func getEnv(key, fallback string) string { if v := os.Getenv(key); v != "" { return v } return fallback }