fix(aihr): keep asr text when audio storage fails
This commit is contained in:
+7
-2
@@ -54,8 +54,13 @@ public class AihrSpeechController {
|
||||
}
|
||||
return speechService.transcribe(file.getBytes(), file.getOriginalFilename(), file.getContentType())
|
||||
.map(text -> {
|
||||
SysOssVo oss = ossService.upload(file);
|
||||
return R.ok(new AsrResponse(text, "openai-compatible", oss.getOssId(), oss.getUrl()));
|
||||
try {
|
||||
SysOssVo oss = ossService.upload(file);
|
||||
return R.ok(new AsrResponse(text, "openai-compatible", oss.getOssId(), oss.getUrl()));
|
||||
} catch (Exception e) {
|
||||
log.warn("asr audio upload failed(处理错误已隐藏)");
|
||||
return R.ok(new AsrResponse(text, "openai-compatible"));
|
||||
}
|
||||
})
|
||||
.orElseGet(() -> R.fail("语音识别失败,请改用文字输入"));
|
||||
}
|
||||
|
||||
+1
@@ -60,6 +60,7 @@ class AihrSensitiveTextTest {
|
||||
assertTrue(interviewSource.contains("AihrSensitiveText.personName(candidate.name(), \"候选人\")"));
|
||||
assertTrue(speechSource.contains("AihrSensitiveText.forModel(text.trim())"));
|
||||
assertTrue(speechSource.contains("asr http {}(外部响应体已隐藏)"));
|
||||
assertTrue(speechControllerSource.contains("asr audio upload failed(处理错误已隐藏)"));
|
||||
assertTrue(speechControllerSource.contains("tts audio upload failed(处理错误已隐藏)"));
|
||||
assertTrue(orgSyncSource.contains("外部响应体已隐藏"));
|
||||
assertTrue(orgSyncSource.contains("外部组织接口请求失败(处理错误已隐藏)"));
|
||||
|
||||
Reference in New Issue
Block a user