fix: 语音转文字接口完善

This commit is contained in:
wenjinbo 2025-09-30 09:44:10 +08:00
parent 9f950db862
commit 9897dd9551
1 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package com.bjtds.brichat.controller;
import com.bjtds.brichat.entity.chat.ChatMessageSendReq;
import com.bjtds.brichat.service.ChatService;
import com.bjtds.brichat.util.ResultUtils;
import io.github.guoshiqiufeng.dify.chat.dto.request.ChatMessageSendRequest;
import io.github.guoshiqiufeng.dify.chat.dto.response.ChatMessageSendCompletionResponse;
import io.swagger.annotations.Api;
@ -74,7 +75,7 @@ public class ChatController {
* @return 转换后的文字
*/
@PostMapping("/voiceToText")
public String voiceToText(@RequestParam("file") MultipartFile file){
public ResultUtils voiceToText(@RequestParam("file") MultipartFile file){
try {
log.info("开始语音转文字,文件名: {}, 文件大小: {} bytes",
file.getOriginalFilename(), file.getSize());
@ -111,7 +112,7 @@ public class ChatController {
Map<String, Object> responseBody = response.getBody();
String text = (String) responseBody.get("text");
log.info("语音转文字成功,结果: {}", text);
return text;
return ResultUtils.success(text);
} else {
log.error("语音转文字失败,响应状态: {}, 响应体: {}",
response.getStatusCode(), response.getBody());