Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private Flux<TtsResult> synthesizeSingleTextWithResult(String text, TtsConfig co
*/
private String getXunfeiVoiceId(String voiceId) {
if (voiceId == null || voiceId.isEmpty()) {
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

voiceId 这里只判断了 isEmpty();如果配置传入的是仅包含空白字符(例如" "),会被当作“不支持的音色”走 warn + fallback。仓库里对字符串空值更常用 trim().isEmpty()(本文件里对 text 也这么做),建议将此处改为对空白同样视为未传入,从而直接使用默认音色且避免无意义的 warn。

Suggested change
if (voiceId == null || voiceId.isEmpty()) {
if (voiceId == null || voiceId.trim().isEmpty()) {

Copilot uses AI. Check for mistakes.
return "x4_lingxiaoyu_emo"; // 默认小燕
return "x4_xiaoyan"; // 默认小燕
}

// 检查是否是科大讯飞支持的音色
Expand All @@ -210,8 +210,8 @@ private String getXunfeiVoiceId(String voiceId) {
}

// 如果传入的音色ID不被支持,使用默认音色
logger.warn("不支持的音色ID: {},使用默认音色: xiaoyan", voiceId);
return "x4_lingxiaoyu_emo";
logger.warn("不支持的音色ID: {},使用默认音色: x4_xiaoyan", voiceId);
return "x4_xiaoyan";
Comment on lines 212 to +214
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认音色ID字符串在该方法里重复了多处(返回值与 warn 文案)。建议提取成单一常量(例如 DEFAULT_VOICE_ID)并在 log/return 处统一引用,避免后续再次调整默认音色时出现日志与实际默认值不一致。

Copilot uses AI. Check for mistakes.
}

/**
Expand Down
Loading