|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.cy.guoyan.admin.module.ai.controller.admin.chatdocument.vo.ChatDocumentPageReqVO;
|
|
|
import com.cy.guoyan.admin.module.ai.controller.admin.chatdocument.vo.ChatDocumentRespVO;
|
|
|
import com.cy.guoyan.admin.module.ai.controller.admin.chatdocument.vo.ChatDocumentSaveReqVO;
|
|
|
+import com.cy.guoyan.admin.module.ai.service.aiservice.AiSelectionService;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import javax.annotation.Resource;
|
|
@@ -35,6 +36,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
public class ChatDocumentController {
|
|
|
@Resource
|
|
|
private ChatDocumentService chatDocumentService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AiSelectionService delegatingDatasetService;
|
|
|
|
|
|
@GetMapping(value = "/file")
|
|
|
@Operation(summary = "查询知识库文档列表")
|
|
@@ -141,12 +145,12 @@ public class ChatDocumentController {
|
|
|
@PreAuthorize("@ss.hasPermission('chatAi:chat-document:create')")
|
|
|
public CommonResult<JSONObject> createChatDocument(
|
|
|
@RequestParam("dataJson") String dataJson,
|
|
|
- @RequestPart(value = "file", required = false) MultipartFile file
|
|
|
- ) throws IOException {
|
|
|
+ @RequestPart(value = "file", required = false) MultipartFile file) throws IOException {
|
|
|
ChatDocumentSaveReqVO createReqVO = JSONObject.parseObject(dataJson, ChatDocumentSaveReqVO.class);
|
|
|
-
|
|
|
- JSONObject result = chatDocumentService.createChatDocument(createReqVO, file);
|
|
|
- return success(result);
|
|
|
+ JSONObject documentByFile = delegatingDatasetService.createDocumentByFile(file, createReqVO, null);
|
|
|
+// JSONObject result = chatDocumentService.createChatDocument(createReqVO, file);
|
|
|
+// return success(result);
|
|
|
+ return success(documentByFile);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -163,7 +167,8 @@ public class ChatDocumentController {
|
|
|
@Parameter(name = "id", description = "编号", required = true)
|
|
|
@PreAuthorize("@ss.hasPermission('chatAi:chat-document:delete')")
|
|
|
public CommonResult<Boolean> deleteChatDocument(@RequestParam("id") Long id) throws IOException {
|
|
|
- chatDocumentService.deleteChatDocument(id);
|
|
|
+ delegatingDatasetService.deleteDocument(null,String.valueOf(id));
|
|
|
+// chatDocumentService.deleteChatDocument(id);
|
|
|
return success(true);
|
|
|
}
|
|
|
|