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.
32 lines
994 B
Java
32 lines
994 B
Java
package com.supervision.pdfqaserver.controller;
|
|
|
|
import com.supervision.pdfqaserver.service.ChatService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.http.MediaType;
|
|
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 reactor.core.publisher.Flux;
|
|
|
|
@Slf4j
|
|
@RestController
|
|
@RequestMapping("/chat")
|
|
@RequiredArgsConstructor
|
|
public class ChatController {
|
|
|
|
private final ChatService chatService;
|
|
|
|
/**
|
|
* 知识问答
|
|
*
|
|
* @param userQuery 用户查询
|
|
* @return 知识问答结果
|
|
*/
|
|
@GetMapping(value = "/knowledgeQA", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
|
public Flux<String> knowledgeQA(@RequestParam("userQuery") String userQuery) {
|
|
return chatService.knowledgeQA(userQuery);
|
|
}
|
|
}
|