xf 维语转语音
This commit is contained in:
@@ -22,6 +22,7 @@ import com.newyetai.component.file.util.FileUtils;
|
||||
import com.newyetai.config.service.ConfigService;
|
||||
import com.newyetai.sdk.xf.config.XfProperties;
|
||||
import com.newyetai.sdk.xf.dto.InterviewContentDTO;
|
||||
import com.newyetai.sdk.xf.dto.TtsReqDTO;
|
||||
import com.newyetai.sdk.xf.model.ChatReq;
|
||||
import com.newyetai.sdk.xf.model.MessageDTO;
|
||||
import com.newyetai.sdk.xf.service.XfSparkProvider;
|
||||
@@ -123,15 +124,14 @@ public class XfUtils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 语音合成
|
||||
* @return
|
||||
* @author sr on 2025-01-09
|
||||
*/
|
||||
public static String tts(String text) {
|
||||
public static String tts(TtsReqDTO ttsReq) {
|
||||
try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream()){
|
||||
AlitaResult<Void> result = WebTtsWS.execute(text, xfProperties, outputStream);
|
||||
AlitaResult<Void> result = WebTtsWS.execute(ttsReq, xfProperties, outputStream);
|
||||
Assert.isTrue(result.getSuccess(), result.getMsg());
|
||||
FileRecord fileRecord = fileService.upload("语音合成.mp3", outputStream.toByteArray());
|
||||
return fileRecord.getFileCode();
|
||||
|
||||
Reference in New Issue
Block a user