liusheng
2025-02-17 32d595cb8c9b608f089c800815bf44210e25117c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.ruoyi.web.controller.smartor.tools;
 
import com.ruoyi.common.core.controller.BaseController;
import com.smartor.service.PersonVoiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Map;
 
/**
 * 人工语音Controller
 *
 * @author ls
 * @date 2023-11-17
 */
@Api(description = "语音合成转换")
@RestController
@RequestMapping("/smartor/voice")
public class PersonVoiceController extends BaseController {
    @Autowired
    private PersonVoiceService personVoiceService;
 
 
    @ApiOperation("语音转文字")
    @GetMapping("/speechtotext")
    public Map<String, Object> speechtotext(@RequestParam("filePath") String filePath) {
        String recognizerListener = personVoiceService.speechtotext(filePath);
        return success(recognizerListener);
    }
 
    @ApiOperation("文字转语音")
    @GetMapping("/texttospeech")
    public Map<String, Object> texttospeech(@RequestParam("textspeech") String textspeech, @RequestParam("filePath") String filePath) {
        String recognizerListener = personVoiceService.texttospeech(textspeech, filePath);
        return success(recognizerListener);
    }
 
    @ApiOperation("html文件处理")
    @GetMapping("/explainHTML")
    public Map<String, Object> explainHTML() {
        Boolean aBoolean = personVoiceService.explainHTML();
        return success(aBoolean);
    }
 
}