added support for qwen3tts aliases, replaces https://github.com/LostRuins/koboldcpp/pull/2315

This commit is contained in:
Concedo 2026-07-12 11:49:33 +08:00
parent 6fffdb5c62
commit 062a2d0bd3
2 changed files with 5 additions and 1 deletions

View file

@ -3023,6 +3023,7 @@ def tts_generate(genparams):
speaker_json = tts_prepare_voice_json(genparams.get("speaker_json","")) #handle custom json voices
voicestr = genparams.get("voice", genparams.get("speaker_wav", ""))
oai_voicemap = ["alloy","onyx","echo","nova","shimmer"] # map to kcpp defaults
q3tts_voicemap = ["aiden","serena","ono_anna","ryan","sohee","eric","dylan","vivian","uncle_fu"]
voice_mapping = voicelist
normalized_voice = voicestr.strip().lower() if voicestr else ""
if normalized_voice.endswith(".wav"):
@ -3031,6 +3032,8 @@ def tts_generate(genparams):
voice = voice_mapping.index(normalized_voice) + 1
elif normalized_voice in oai_voicemap:
voice = oai_voicemap.index(normalized_voice) + 1
elif normalized_voice in q3tts_voicemap:
voice = q3tts_voicemap.index(normalized_voice) + 1
else:
voice = simple_lcg_hash(voicestr.strip()) if voicestr else 1
inputs = tts_generation_inputs()

View file

@ -1181,9 +1181,10 @@ static tts_generation_outputs ttstype_generate_qwen3tts(const tts_generation_inp
std::string speaker_instruction = inputs.speaker_instruction;
int speakerID = inputs.speaker_seed;
//{"aiden":2861, "dylan":2878, "eric":2875, "ono_anna":2873,"ryan":3061, "serena":3066, "sohee":2864, "uncle_fu":3010, "vivian":3065}
int speakermap[] = {2861,3066,2873,3061,2864,2875,2878,3065,3010};
if (speakerID > 0 && speakerID <= 5) {
if (speakerID > 0 && speakerID <= 9) {
speakerID = speakermap[speakerID-1];
} else {
speakerID = -1;