package thyyxxk.webserver.controller.voice;

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 thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.utils.SnowFlakeId;
import thyyxxk.webserver.utils.VoiceUtil;

/**
 * @description: 生成语音文件接口
 * @author: DingJie
 * @create: 2021/7/299:23
 */
@RestController
@RequestMapping("/voice")
public class VoiceController {

    @PassToken
    @GetMapping("/textToSpeech")
    public ResultVo<String> textToSpeech(@RequestParam("text") String text) {
        String id = SnowFlakeId.instance().nextId();
        return VoiceUtil.textToSpeech(text, id);
    }

}
