package com.yn.bftl.thirdparty.modules.tencent.controller.member;

import com.yn.bftl.thirdparty.modules.tencent.service.AsrService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;

/**
 * 语音识别控制器
 *
 * @author huabiao
 * @create 2023/8/9  10:52
 **/
@Validated
@Api(value = "AsrMemberController", tags = "用户端-语音识别")
@RestController
@RequestMapping("/member/tencent/asr")
public class AsrMemberController {

    @Resource
    private AsrService asrService;

    @ApiOperation(value = "语音识别-一句话识别")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "url", value = "语音的URL路径", required = true, dataType = "String", dataTypeClass = String.class)
    })
    @RequestMapping(value = "/recognition/url", method = RequestMethod.GET)
    public String sentenceRecognition(@NotBlank String url) {
        return asrService.sentenceRecognition(url);
    }
}
