You've already forked DataMate
feat: Refactor dataset file pagination and enhance retrieval functionality with new request structure #98
* feat: Enhance knowledge base management with collection renaming, imp… * feat: Update Milvus integration with new API, enhance collection mana… * Merge branch 'refs/heads/main' into dev * feat: Refactor dataset file pagination and enhance retrieval function… * Merge branch 'main' into dev
This commit is contained in:
@@ -16,7 +16,12 @@ public enum KnowledgeBaseErrorCode implements ErrorCode {
|
||||
/**
|
||||
* 知识库不存在
|
||||
*/
|
||||
KNOWLEDGE_BASE_NOT_FOUND("knowledge.0001", "知识库不存在");
|
||||
KNOWLEDGE_BASE_NOT_FOUND("knowledge.0001", "知识库不存在"),
|
||||
|
||||
/**
|
||||
* 文件不存在
|
||||
*/
|
||||
RAG_FILE_NOT_FOUND("knowledge.0002", "文件不存在");
|
||||
|
||||
private final String code;
|
||||
private final String message;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.datamate.common.interfaces;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -10,9 +10,8 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PagedResponse <T> {
|
||||
// 当前页码(从 0 开始)
|
||||
public class PagedResponse<T> {
|
||||
// 当前页码(从 1 开始)
|
||||
private long page;
|
||||
// 每页数量
|
||||
private long size;
|
||||
@@ -36,6 +35,14 @@ public class PagedResponse <T> {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public PagedResponse(long page, long size, long totalElements, long totalPages, List<T> content) {
|
||||
this.page = page;
|
||||
this.size = size;
|
||||
this.totalElements = totalElements;
|
||||
this.totalPages = totalPages;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public static <T> PagedResponse<T> of(List<T> content) {
|
||||
return new PagedResponse<>(content);
|
||||
}
|
||||
@@ -43,4 +50,8 @@ public class PagedResponse <T> {
|
||||
public static <T> PagedResponse<T> of(List<T> content, long page, long totalElements, long totalPages) {
|
||||
return new PagedResponse<>(content, page, totalElements, totalPages);
|
||||
}
|
||||
|
||||
public static <T> PagedResponse<T> of(IPage<T> page) {
|
||||
return new PagedResponse<>(page.getCurrent(), page.getSize(), page.getTotal(), page.getPages(), page.getRecords());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.datamate.common.interfaces;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
public class PagingQuery {
|
||||
/**
|
||||
* 页码,从0开始
|
||||
@@ -28,4 +30,9 @@ public class PagingQuery {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
public PagingQuery(Integer page, Integer size) {
|
||||
setPage(page);
|
||||
setSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user