xf 听写用pcm

This commit is contained in:
ran.shang
2025-07-03 10:33:18 +08:00
parent 7784ba724c
commit a033ad1f35
4 changed files with 3 additions and 4 deletions

View File

@@ -57,7 +57,7 @@ public class WebIATWS extends WebSocketListener {
InputStream is; InputStream is;
private String appId; private String appId;
// mp3格式 // mp3格式
private String encoding = "lame"; private String encoding = "raw";
private AlitaResult<String> result; private AlitaResult<String> result;
WebIATWS(InputStream is, String appId) { WebIATWS(InputStream is, String appId) {

View File

@@ -163,7 +163,7 @@ public class WebTtsWS extends WebSocketListener {
return AlitaResult.success(); return AlitaResult.success();
} catch (Exception e) { } catch (Exception e) {
log.info("err ", e); log.info("err ", e);
return AlitaResult.error("语音听写失败:{}", e.getMessage()); return AlitaResult.error("语音合成失败:{}", e.getMessage());
} }
} }

View File

@@ -106,8 +106,7 @@ public class XfUtils {
* @author sr on 2025-01-09 * @author sr on 2025-01-09
*/ */
public static String iat(String fileCode) { public static String iat(String fileCode) {
FileRecord fileRecord = fileRecordService.find(FileRecord.builder().fileCode(fileCode).build()); try (InputStream is = fileRecordService.getFile(fileCode)){
try (InputStream is = FileUtils.convertWebmToMp3(new File(fileRecord.getFilePath()))){
AlitaResult<String> result = WebIATWS.execute(is, xfProperties); AlitaResult<String> result = WebIATWS.execute(is, xfProperties);
Assert.isTrue(result.getSuccess(), result.getMsg()); Assert.isTrue(result.getSuccess(), result.getMsg());
return result.getData(); return result.getData();

Binary file not shown.