|
@@ -22,6 +22,7 @@ import lombok.experimental.Accessors;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.msgpack.jackson.dataformat.MessagePackFactory;
|
|
import org.msgpack.jackson.dataformat.MessagePackFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
@@ -41,6 +42,9 @@ public class FishApiServiceImpl implements FishApiService {
|
|
|
|
|
|
|
|
private static final String apiKey = "0891f3f93a2640428f9988e267aa57e1";
|
|
private static final String apiKey = "0891f3f93a2640428f9988e267aa57e1";
|
|
|
|
|
|
|
|
|
|
+ @Value("${api.proxy.url:http://47.242.29.135:8080/proxy/byte}")
|
|
|
|
|
+ private String proxyUrl;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void importTTSModels(String speakerId) {
|
|
public void importTTSModels(String speakerId) {
|
|
|
if (StringUtils.hasText(speakerId)) {
|
|
if (StringUtils.hasText(speakerId)) {
|
|
@@ -186,6 +190,7 @@ public class FishApiServiceImpl implements FishApiService {
|
|
|
}
|
|
}
|
|
|
String apiUrl = "https://api.fish.audio/v1/tts";
|
|
String apiUrl = "https://api.fish.audio/v1/tts";
|
|
|
Map<String, String> headerMap = buildCommonHeaderMap();
|
|
Map<String, String> headerMap = buildCommonHeaderMap();
|
|
|
|
|
+ headerMap.put("Target-URL", apiUrl);
|
|
|
Map<String, String> paramMap = new HashMap<>();
|
|
Map<String, String> paramMap = new HashMap<>();
|
|
|
paramMap.put("reference_id", speakerId);
|
|
paramMap.put("reference_id", speakerId);
|
|
|
paramMap.put("text", text);
|
|
paramMap.put("text", text);
|
|
@@ -195,7 +200,7 @@ public class FishApiServiceImpl implements FishApiService {
|
|
|
int retryTimes = 0;
|
|
int retryTimes = 0;
|
|
|
do {
|
|
do {
|
|
|
retryTimes++;
|
|
retryTimes++;
|
|
|
- HttpResponseContent hrc = HttpClientUtils.postDataAddHeader(apiUrl, JSON.toJSONString(paramMap), headerMap,
|
|
|
|
|
|
|
+ HttpResponseContent hrc = HttpClientUtils.postDataAddHeader(proxyUrl, JSON.toJSONString(paramMap), headerMap,
|
|
|
10000, 1800000);
|
|
10000, 1800000);
|
|
|
if (Objects.isNull(hrc)) {
|
|
if (Objects.isNull(hrc)) {
|
|
|
log.error("fishTTS hrc is null,bizId:{}", bizId);
|
|
log.error("fishTTS hrc is null,bizId:{}", bizId);
|