package com.supervision.controller;

import cn.hutool.core.util.StrUtil;
import com.supervision.exception.BusinessException;
import com.supervision.service.AskService;
import com.supervision.vo.RoundTalkReqVO;
import com.supervision.vo.RoundTalkResVO;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.C;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("ask")
@RequiredArgsConstructor
public class AskController {

    private final AskService askService;

    @ApiOperation("多轮对话")
    @PostMapping("roundTalk")
    public RoundTalkResVO roundTalk(@RequestBody RoundTalkReqVO roundTalkReqVO) {
        if (StrUtil.isBlank(roundTalkReqVO.getSessionId())) {
            throw new BusinessException("会话ID不能为空");
        }
        return askService.roundTalk(roundTalkReqVO);
    }
}