模型调整以及业务流程处理

This commit is contained in:
2025-10-25 10:32:53 +08:00
parent 775bd96417
commit 6ce56d7219
4 changed files with 20 additions and 12 deletions

View File

@@ -53,7 +53,7 @@ public class ElevenLabsClient {
Map<String, Object> payload = new HashMap<>();
payload.put("text", text);
payload.put("model_id", modelId);
payload.put("voice_settings", new VoiceSettings(0.85, 0.5,1.1,0,0.9));
payload.put("voice_settings", new VoiceSettings(0.85, 0.5,0.1,0,0.9,0.8));
Gson gson = new Gson();
StringEntity entity = new StringEntity(gson.toJson(payload), ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
@@ -102,12 +102,6 @@ public class ElevenLabsClient {
public String handleTextToVoice(String inputText,String outputFile){
CloseableHttpClient httpClient = HttpClients.createDefault();
try {
// // 获取可用语音
// VoicesResponse voicesResponse = getVoices(httpClient);
// if (voicesResponse != null && voicesResponse.getVoices() != null
// && voicesResponse.getVoices().length > 0) {
//
// }
// 使用第一个可用语音进行文本转语音(澳洲本地女声)
String firstVoiceId = "21m00Tcm4TlvDq8ikWAM";
textToSpeech(inputText, firstVoiceId, outputFile,httpClient);

View File

@@ -18,12 +18,15 @@ public class VoiceSettings {
private double clarity;
public VoiceSettings(double stability, double similarity_boost, double rate,double start_time,double clarity) {
private double speed;
public VoiceSettings(double stability, double similarity_boost, double rate,double start_time,double clarity, double speed) {
this.stability = stability;
this.similarity_boost = similarity_boost;
this.rate = rate;
this.start_time = start_time;
this.clarity = clarity;
this.speed = speed;
}
// getter方法
@@ -45,4 +48,9 @@ public class VoiceSettings {
public double getClarity() {
return clarity;
}
public double getSpeed() {
return speed;
}
}