|
|
@ -96,8 +96,8 @@ public class ImContentServiceImpl extends ServiceImpl<ImContentMapper, ImContent |
|
|
|
fileService.save(sendOssOssFile); |
|
|
|
fileService.save(sendOssOssFile); |
|
|
|
imContent.setFiles(sendOssOssFile.getId()); |
|
|
|
imContent.setFiles(sendOssOssFile.getId()); |
|
|
|
|
|
|
|
|
|
|
|
File inputVoiceFile = File.createTempFile(sendFileName, StrUtil.DOT + FileUtil.extName(file.getOriginalFilename())); |
|
|
|
File inputVoiceFile = File.createTempFile(FileUtil.getPrefix(file.getOriginalFilename()), StrUtil.DOT + FileUtil.extName(file.getOriginalFilename())); |
|
|
|
File outputVoiceFile = File.createTempFile(sendFileName, StrUtil.DOT + FileUtil.extName(file.getOriginalFilename())); |
|
|
|
File outputVoiceFile = File.createTempFile(FileUtil.getPrefix(speechName), StrUtil.DOT + FileUtil.extName(speechName)); |
|
|
|
ImContent receiveContent; |
|
|
|
ImContent receiveContent; |
|
|
|
OssFile receiveOssOssFile; |
|
|
|
OssFile receiveOssOssFile; |
|
|
|
try { |
|
|
|
try { |
|
|
@ -121,7 +121,7 @@ public class ImContentServiceImpl extends ServiceImpl<ImContentMapper, ImContent |
|
|
|
.input(receiveContent.getContent()) |
|
|
|
.input(receiveContent.getContent()) |
|
|
|
.voice(openAiConfigProperties.getVoice()) |
|
|
|
.voice(openAiConfigProperties.getVoice()) |
|
|
|
.responseFormat(FileUtil.extName(speechName)) |
|
|
|
.responseFormat(FileUtil.extName(speechName)) |
|
|
|
.speed(1.0) |
|
|
|
.speed(openAiConfigProperties.getSpeed()) |
|
|
|
.build(); |
|
|
|
.build(); |
|
|
|
ResponseBody responseBody = openAiService.createSpeech(createSpeechRequest); |
|
|
|
ResponseBody responseBody = openAiService.createSpeech(createSpeechRequest); |
|
|
|
FileUtil.writeBytes(responseBody.bytes(), outputVoiceFile); |
|
|
|
FileUtil.writeBytes(responseBody.bytes(), outputVoiceFile); |
|
|
|