修改rag的实体类
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user