You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB
Java

package com.supervision.controller;
import cn.hutool.core.util.StrUtil;
import com.supervision.exception.BusinessException;
import com.supervision.service.AskService;
import com.supervision.vo.*;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.Set;
@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);
}
@ApiOperation("单轮对话")
@PostMapping("singleTalk")
public SingleTalkResVO singleTalk(@RequestBody SingleTalkReqVO singleTalkReqVO) {
return askService.singleTalk(singleTalkReqVO);
}
@ApiOperation("多轮对话中用户手动填写参数,可能直接返回结果")
@PostMapping("saveUserParam")
public RoundTalkResVO saveUserParam(@RequestBody RoleSetReqVO paramReqVO) {
return askService.saveUserParam(paramReqVO);
}
@ApiOperation("查询多轮对话中用户需要填写的参数")
@GetMapping("queryUserNeedParam")
public RoleSetResVO queryUserNeedParam(String sessionId) {
return askService.queryUserNeedParam(sessionId);
}
}