fix: change default Xunfei TTS voice to authorized x4_xiaoyan#13
Merged
Conversation
The previous default x4_lingxiaoyu_emo was not authorized in the Xunfei console, causing TTS API error 11200 (licc failed).
There was a problem hiding this comment.
Pull request overview
This PR updates the default Xunfei (iFlytek) TTS voice to an authorized voice ID to prevent API failures when no voice is provided.
Changes:
- Change the default fallback voice from
x4_lingxiaoyu_emotox4_xiaoyan. - Update the warning log message to reflect the new default voice ID.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
212
to
+214
| // 如果传入的音色ID不被支持,使用默认音色 | ||
| logger.warn("不支持的音色ID: {},使用默认音色: xiaoyan", voiceId); | ||
| return "x4_lingxiaoyu_emo"; | ||
| logger.warn("不支持的音色ID: {},使用默认音色: x4_xiaoyan", voiceId); | ||
| return "x4_xiaoyan"; |
There was a problem hiding this comment.
默认音色ID字符串在该方法里重复了多处(返回值与 warn 文案)。建议提取成单一常量(例如 DEFAULT_VOICE_ID)并在 log/return 处统一引用,避免后续再次调整默认音色时出现日志与实际默认值不一致。
| @@ -199,7 +199,7 @@ private Flux<TtsResult> synthesizeSingleTextWithResult(String text, TtsConfig co | |||
| */ | |||
| private String getXunfeiVoiceId(String voiceId) { | |||
| if (voiceId == null || voiceId.isEmpty()) { | |||
There was a problem hiding this comment.
voiceId 这里只判断了 isEmpty();如果配置传入的是仅包含空白字符(例如" "),会被当作“不支持的音色”走 warn + fallback。仓库里对字符串空值更常用 trim().isEmpty()(本文件里对 text 也这么做),建议将此处改为对空白同样视为未传入,从而直接使用默认音色且避免无意义的 warn。
Suggested change
| if (voiceId == null || voiceId.isEmpty()) { | |
| if (voiceId == null || voiceId.trim().isEmpty()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous default x4_lingxiaoyu_emo was not authorized in the Xunfei console, causing TTS API error 11200 (licc failed).
📌 变更内容
✅ 测试验证
PR 提交规范提醒: