Compare commits
No commits in common. "73b332de51c05661606bca472271e076d11db0e8" and "fb1237b1d392a1fcd86dc91fcfdb202d49504f35" have entirely different histories.
73b332de51
...
fb1237b1d3
|
|
@ -1,9 +0,0 @@
|
||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
export function getSegmentList(params: { datasetId: string; documentId: string }) {
|
|
||||||
return request({
|
|
||||||
url: '/brichat-service/documentSegment/selectSegments',
|
|
||||||
method: 'get',
|
|
||||||
params,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,29 +0,0 @@
|
||||||
package com.bjtds.brichat.controller;
|
|
||||||
|
|
||||||
import com.bjtds.brichat.entity.dto.SegmentDto;
|
|
||||||
import com.bjtds.brichat.service.dify.DocumentSegmentService;
|
|
||||||
import com.bjtds.brichat.util.ResultUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.checkerframework.checker.units.qual.C;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@Slf4j
|
|
||||||
@CrossOrigin(value = "*", maxAge = 3600)
|
|
||||||
@RequestMapping("/documentSegment")
|
|
||||||
public class DocumentSegmentController {
|
|
||||||
@Autowired
|
|
||||||
private DocumentSegmentService documentSegmentService;
|
|
||||||
|
|
||||||
@GetMapping("/selectSegments")
|
|
||||||
public ResultUtils SelectSegments(@RequestParam("documentId") String documentId, @RequestParam("datasetId") String datasetId) {
|
|
||||||
List<SegmentDto> segments = documentSegmentService.SelectSegments(documentId, datasetId);
|
|
||||||
segments.sort(Comparator.comparing(SegmentDto::getPosition));
|
|
||||||
return ResultUtils.success(segments);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
package com.bjtds.brichat.mapper.postgresql;
|
|
||||||
|
|
||||||
|
|
||||||
import com.bjtds.brichat.entity.dto.SegmentDto;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface DifyDocumentSegmentMapper {
|
|
||||||
|
|
||||||
List<SegmentDto> SelectSegmentsByDocumentIdAndDatasetId(String documentId, String datasetId);
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
package com.bjtds.brichat.service.dify;
|
|
||||||
|
|
||||||
import com.bjtds.brichat.entity.dto.SegmentDto;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface DocumentSegmentService {
|
|
||||||
|
|
||||||
List<SegmentDto> SelectSegments(String documentId, String datasetId);
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package com.bjtds.brichat.service.dify.impl;
|
|
||||||
|
|
||||||
import com.bjtds.brichat.entity.dto.SegmentDto;
|
|
||||||
import com.bjtds.brichat.mapper.postgresql.DifyDocumentSegmentMapper;
|
|
||||||
import com.bjtds.brichat.service.dify.DocumentSegmentService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class DocumentSegmentServiceImpl implements DocumentSegmentService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DifyDocumentSegmentMapper difyDocumentSegmentMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SegmentDto> SelectSegments(String documentId, String datasetId) {
|
|
||||||
return difyDocumentSegmentMapper.SelectSegmentsByDocumentIdAndDatasetId(documentId, datasetId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.bjtds.brichat.mapper.postgresql.DifyDocumentSegmentMapper">
|
|
||||||
<select id="SelectSegmentsByDocumentIdAndDatasetId" resultType="com.bjtds.brichat.entity.dto.SegmentDto">
|
|
||||||
select *
|
|
||||||
from document_segments
|
|
||||||
where
|
|
||||||
<if test="documentId != null">
|
|
||||||
document_id = CAST(#{documentId} as uuid) and
|
|
||||||
</if>
|
|
||||||
<if test="datasetId != null">
|
|
||||||
dataset_id = CAST(#{datasetId} as uuid)
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
Loading…
Reference in New Issue