|
@@ -1,10 +1,6 @@
|
|
package cn.jlsxwkj.moudles.chat;
|
|
package cn.jlsxwkj.moudles.chat;
|
|
|
|
|
|
-import cn.jlsxwkj.moudles.chathistory.ChatHistory;
|
|
|
|
-import cn.jlsxwkj.moudles.chathistory.ChatHistoryService;
|
|
|
|
-import cn.jlsxwkj.moudles.userlist.UserListService;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
-import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
@@ -13,7 +9,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|
import reactor.core.publisher.Flux;
|
|
import reactor.core.publisher.Flux;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
-import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author zh
|
|
* @author zh
|
|
@@ -25,43 +20,29 @@ public class ChatController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private ChatService chatService;
|
|
private ChatService chatService;
|
|
- @Resource
|
|
|
|
- private ChatHistoryService chatHistoryService;
|
|
|
|
- @Resource
|
|
|
|
- private UserListService userListService;
|
|
|
|
|
|
|
|
@Operation(summary = "上传文档")
|
|
@Operation(summary = "上传文档")
|
|
@PostMapping("/upload")
|
|
@PostMapping("/upload")
|
|
- public String uploadDoc(
|
|
|
|
- @Parameter(name = "file", description = "文件") @RequestBody MultipartFile file) throws IOException {
|
|
|
|
|
|
+ public String uploadDoc(@RequestBody MultipartFile file) throws IOException {
|
|
return chatService.uploadDocument(file);
|
|
return chatService.uploadDocument(file);
|
|
}
|
|
}
|
|
|
|
|
|
@Operation(summary = "搜索文档")
|
|
@Operation(summary = "搜索文档")
|
|
@PostMapping("/search")
|
|
@PostMapping("/search")
|
|
- public String searchDoc(
|
|
|
|
- @Parameter(name = "keyword", description = "关键词") @RequestParam String keyword) {
|
|
|
|
|
|
+ public String searchDoc(@RequestParam String keyword) {
|
|
return chatService.search(keyword);
|
|
return chatService.search(keyword);
|
|
}
|
|
}
|
|
|
|
|
|
- @Operation(summary = "获取历史对话")
|
|
|
|
- @PostMapping("/getHistory")
|
|
|
|
- public List<ChatHistory> selectHistory() {
|
|
|
|
- return chatHistoryService.selectHistoryByUserId();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Operation(summary = "问答文档流")
|
|
@Operation(summary = "问答文档流")
|
|
@PostMapping(value = "/chatStream", produces = {MediaType.TEXT_EVENT_STREAM_VALUE})
|
|
@PostMapping(value = "/chatStream", produces = {MediaType.TEXT_EVENT_STREAM_VALUE})
|
|
- public Flux<String> chatStream(
|
|
|
|
- @Parameter(name = "message", description = "消息") @RequestParam String message) {
|
|
|
|
|
|
+ public Flux<String> chatStream(@RequestParam String message) {
|
|
return chatService.chatStream(message);
|
|
return chatService.chatStream(message);
|
|
}
|
|
}
|
|
|
|
|
|
@Operation(summary = "问答文档")
|
|
@Operation(summary = "问答文档")
|
|
@PostMapping(value = "/chat")
|
|
@PostMapping(value = "/chat")
|
|
@Deprecated
|
|
@Deprecated
|
|
- public String chat(
|
|
|
|
- @Parameter(name = "message", description = "消息") @RequestParam String message) {
|
|
|
|
|
|
+ public String chat(@RequestParam String message) {
|
|
return chatService.chat(message);
|
|
return chatService.chat(message);
|
|
}
|
|
}
|
|
}
|
|
}
|