修改rag的实体类

This commit is contained in:
Cold
2025-12-02 14:59:07 +08:00
committed by 张斌
parent cd3571554f
commit 5d4c8c8711
6 changed files with 78 additions and 40 deletions

View File

@@ -39,12 +39,13 @@ type ListChunksReq struct {
}
// ListChunksRes 列出知识块响应
// 注意:响应结构包含 chunks知识块列表、doc关联文档信息和 total总数
type ListChunksRes struct {
Code int `json:"code"`
Code int `json:"code"` // 状态码0 表示成功
Data struct {
Chunks []*Chunk `json:"chunks"`
Doc interface{} `json:"doc"` // 文档信息,暂时用 interface{}
Total int `json:"total"`
Chunks []*Chunk `json:"chunks"` // 知识块列表
Doc interface{} `json:"doc"` // 关联文档信息(完整的 Document 对象)
Total int `json:"total"` // 知识块总数
} `json:"data"`
}
@@ -108,7 +109,7 @@ func (c *Client) AddChunk(ctx context.Context, datasetId, documentId string, req
// ListChunks 列出知识块
func (c *Client) ListChunks(ctx context.Context, datasetId, documentId string, req *ListChunksReq) (*ListChunksRes, error) {
path := fmt.Sprintf("/api/v1/datasets/%s/documents/%s/chunks?", datasetId, documentId)
path := fmt.Sprintf("/api/v1/datasets/%s/documents/%s/chunks", datasetId, documentId)
params := map[string]interface{}{}
if req.Keywords != "" {
params["keywords"] = req.Keywords