|
@@ -55,7 +55,9 @@ public class DouBaoTtsService {
|
|
|
Map<String, Object> audioParams = new HashMap<>();
|
|
Map<String, Object> audioParams = new HashMap<>();
|
|
|
audioParams.put("format", "mp3"); // 输出音频格式
|
|
audioParams.put("format", "mp3"); // 输出音频格式
|
|
|
audioParams.put("sample_rate", 16000); // 推荐采样率
|
|
audioParams.put("sample_rate", 16000); // 推荐采样率
|
|
|
-// audioParams.put("emotion", "开心");
|
|
|
|
|
|
|
+ if (aiTtsDO.getEmotion() != null && !aiTtsDO.getEmotion().isEmpty()) {
|
|
|
|
|
+ audioParams.put("emotion", aiTtsDO.getEmotion());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 语速和音量参数
|
|
// 语速和音量参数
|
|
|
if (aiTtsDO.getSpeechRate() != null) {
|
|
if (aiTtsDO.getSpeechRate() != null) {
|
|
@@ -77,6 +79,8 @@ public class DouBaoTtsService {
|
|
|
//语音指令
|
|
//语音指令
|
|
|
if (command != null && !command.isEmpty()) {
|
|
if (command != null && !command.isEmpty()) {
|
|
|
additions.put("context_texts", List.of(command));
|
|
additions.put("context_texts", List.of(command));
|
|
|
|
|
+ }else if (aiTtsDO.getCommand() != null && !aiTtsDO.getCommand().isEmpty()){
|
|
|
|
|
+ additions.put("context_texts", List.of(aiTtsDO.getCommand()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 将 additions 映射序列化为 JSON 字符串
|
|
// 将 additions 映射序列化为 JSON 字符串
|