feat(voice): 百炼声音复刻create_voice + TTS instruction情绪驱动(主TTS-昔涟复刻音色)
This commit is contained in:
1 parent
73dabb9dde
commit
03d7050e1e
15 files changed
+686
-30
No files matched your search
@@ -126,6 +126,15 @@ type VoiceConfig struct {
|
||||
TTSVoiceID string `env:"VOICE_TTS_VOICE_ID" default:"longxiaochun_v3"`
|
||||
TTSFormat string `env:"VOICE_TTS_FORMAT" default:"wav"`
|
||||
TTSSampleRate int `env:"VOICE_TTS_SAMPLE_RATE" default:"24000"`
|
||||
// VoiceTTSInstruction is the emotion/tone instruction driving a cloned/designed
|
||||
// TTS voice (e.g. "语气开朗俏皮,像女朋友撒娇"). cosyvoice v3 system voices (the
|
||||
// long*_v3 family) require a fixed instruction format, so a free-form instruction
|
||||
// is never sent for them — only for a cloned/designed voice (声音复刻).
|
||||
VoiceTTSInstruction string `env:"VOICE_TTS_INSTRUCTION" default:""`
|
||||
// VoiceClonePrefix is the name prefix used when creating a custom voice (声音复刻
|
||||
// create_voice). It must be ≤10 alphanumeric chars; the empty value falls back
|
||||
// to "cyrene". target_model stays TTSModel (must match the synthesis model).
|
||||
VoiceClonePrefix string `env:"VOICE_CLONE_PREFIX" default:"cyrene"`
|
||||
}
|
||||
|
||||
// BackgroundConfig holds the autonomous thinking settings. QuietStartHour and
|
||||
|
||||
@@ -190,6 +190,12 @@ func TestLoad_VoiceDefaults(t *testing.T) {
|
||||
if cfg.Voice.TTSSampleRate != 24000 {
|
||||
t.Errorf("TTSSampleRate = %d, want 24000", cfg.Voice.TTSSampleRate)
|
||||
}
|
||||
if cfg.Voice.VoiceTTSInstruction != "" {
|
||||
t.Errorf("VoiceTTSInstruction = %q, want empty (default)", cfg.Voice.VoiceTTSInstruction)
|
||||
}
|
||||
if cfg.Voice.VoiceClonePrefix != "cyrene" {
|
||||
t.Errorf("VoiceClonePrefix = %q, want cyrene (default)", cfg.Voice.VoiceClonePrefix)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoad_VoiceEnvOverrides(t *testing.T) {
|
||||
@@ -209,6 +215,23 @@ func TestLoad_VoiceEnvOverrides(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoad_VoiceCloneInstructionEnvOverrides(t *testing.T) {
|
||||
t.Setenv("JWT_SECRET", strings.Repeat("s", 40))
|
||||
t.Setenv("VOICE_TTS_INSTRUCTION", "语气开朗俏皮,像女朋友撒娇")
|
||||
t.Setenv("VOICE_CLONE_PREFIX", "xilian")
|
||||
|
||||
cfg, err := Load("")
|
||||
if err != nil {
|
||||
t.Fatalf("Load() error: %v", err)
|
||||
}
|
||||
if cfg.Voice.VoiceTTSInstruction != "语气开朗俏皮,像女朋友撒娇" {
|
||||
t.Errorf("VoiceTTSInstruction = %q, want the env instruction", cfg.Voice.VoiceTTSInstruction)
|
||||
}
|
||||
if cfg.Voice.VoiceClonePrefix != "xilian" {
|
||||
t.Errorf("VoiceClonePrefix = %q, want xilian", cfg.Voice.VoiceClonePrefix)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseDotEnv_QuotedAndExport(t *testing.T) {
|
||||
path := writeEnvFile(t, `export FOO=bar
|
||||
BAZ='quoted value'
|
||||
|
||||
Reference in new issue
Block a user