[Bugfix] Validate speaker in chat endpoint and fix case-insensitive lookup (#2407)

Signed-off-by: reidliu41 <reid201711@gmail.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
ReidandHongsheng Liu authored and GitHub committed 2026-04-12 00:14:16 -04:00
1 parent c20cac86ce
commit 38dfe56fdf
4 files changed
+169 -6

No files matched your search

@@ -610,13 +610,14 @@ class Qwen3OmniMoeForConditionalGeneration(
# Speaker token IDs (for voice selection)
# In Qwen3, speaker_id mapping is in talker_config.speaker_id
# Keys are lowercased for case-insensitive matching with serving layer.
if hasattr(talker_hf_config, "speaker_id") and talker_hf_config.speaker_id:
self.tts_text_spk_token_ids = talker_hf_config.speaker_id
self.tts_text_spk_token_ids = {k.lower(): v for k, v in talker_hf_config.speaker_id.items()}
else:
# Default to audio_start_token_id if no speaker mapping
self.tts_text_spk_token_ids = {
"default": talker_hf_config.audio_start_token_id,
"Ethan": talker_hf_config.audio_start_token_id,
"ethan": talker_hf_config.audio_start_token_id,
"prefix_caching": talker_hf_config.audio_start_token_id,
}