| | |
| | | |
| | | @GetMapping("/split") |
| | | @Operation(summary = "预览文档切分结果") |
| | | @PreAuthorize("@ss.hasPermission('ai:knowledge:query')") |
| | | public CommonResult<List<AiKnowledgeSegmentSplitRespVO>> previewSplit(@Valid AiKnowledgeSegmentSplitReqVO reqVO) { |
| | | String fileUrl = reqVO.getUrl(); |
| | | if (fileUrl == null || fileUrl.isEmpty()) { |
| | |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获取分段") |
| | | @PreAuthorize("@ss.hasPermission('ai:knowledge:query')") |
| | | public CommonResult<AiKnowledgeSegmentRespVO> getSegment(@RequestParam("id") Long id) { |
| | | return success(BeanUtils.toBean(segmentService.getSegment(id), AiKnowledgeSegmentRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获取分段分页") |
| | | @PreAuthorize("@ss.hasPermission('ai:knowledge:query')") |
| | | public CommonResult<PageResult<AiKnowledgeSegmentRespVO>> getSegmentPage(@Valid AiKnowledgeSegmentPageReqVO pageReqVO) { |
| | | PageResult<AiKnowledgeSegmentDO> pageResult = segmentService.getSegmentPage(pageReqVO); |
| | | return success(BeanUtils.toBean(pageResult, AiKnowledgeSegmentRespVO.class)); |
| | |
| | | |
| | | @GetMapping("/get-process-list") |
| | | @Operation(summary = "获取文档处理进度") |
| | | @PreAuthorize("@ss.hasPermission('ai:knowledge:query')") |
| | | public CommonResult<List<AiKnowledgeSegmentProcessRespVO>> getProcessList(@RequestParam("documentIds") List<Long> documentIds) { |
| | | return success(documentService.getDocumentProcessingProgress(documentIds)); |
| | | } |
| | | |
| | | @PostMapping("/search") |
| | | @Operation(summary = "检索分段(RAG 向量检索)") |
| | | @PreAuthorize("@ss.hasPermission('ai:knowledge:query')") |
| | | public CommonResult<List<AiKnowledgeSegmentSearchRespVO>> searchSegments(@Valid @RequestBody AiKnowledgeSegmentSearchReqVO searchReqVO) { |
| | | AiKnowledgeSegmentSearchReqBO searchReqBO = BeanUtils.toBean(searchReqVO, AiKnowledgeSegmentSearchReqBO.class); |
| | | List<AiKnowledgeSegmentSearchRespBO> results = segmentService.searchSegments(searchReqBO); |