This commit is contained in:
hajimi
2026-06-11 16:22:12 +08:00
parent 96efa1d905
commit 21aa11bf17
368 changed files with 2741 additions and 554 deletions
@@ -3,6 +3,7 @@
namespace app\api\controller;
use app\common\service\chat\PrivateChatService;
use app\common\service\chat\WhisperAsrService;
class ChatController extends BaseApiController
{
@@ -49,4 +50,17 @@ class ChatController extends BaseApiController
}
return $this->data($result['data']);
}
public function voiceToText()
{
if ($this->userId <= 0) {
return $this->fail('请先登录');
}
$result = WhisperAsrService::transcribeUploadedFile($this->request->file('file'));
if (empty($result['success'])) {
return $this->fail($result['error'] ?? '语音识别失败');
}
return $this->data($result['data']);
}
}