mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-18 21:57:27 +08:00
Fix go cli: search on datasets (#14692)
### What problem does this PR solve? As title ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -498,7 +498,7 @@ func (c *RAGFlowClient) SearchOnDatasets(cmd *Command) (ResponseIf, error) {
|
||||
}
|
||||
|
||||
payload := map[string]interface{}{
|
||||
"kb_id": datasetIDs,
|
||||
"dataset_ids": datasetIDs,
|
||||
"question": question,
|
||||
"similarity_threshold": 0.2,
|
||||
"vector_similarity_weight": 0.3,
|
||||
@@ -506,11 +506,11 @@ func (c *RAGFlowClient) SearchOnDatasets(cmd *Command) (ResponseIf, error) {
|
||||
|
||||
if iterations > 1 {
|
||||
// Benchmark mode - return raw result for benchmark stats
|
||||
return c.HTTPClient.RequestWithIterations("POST", "/chunk/retrieval_test", "web", nil, payload, iterations)
|
||||
return c.HTTPClient.RequestWithIterations("POST", "/datasets/search", "web", nil, payload, iterations)
|
||||
}
|
||||
|
||||
// Normal mode
|
||||
resp, err := c.HTTPClient.Request("POST", "/chunk/retrieval_test", "web", nil, payload)
|
||||
resp, err := c.HTTPClient.Request("POST", "/datasets/search", "web", nil, payload)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to search on datasets: %w", err)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewChunkHandler(chunkService *service.ChunkService, userService *service.Us
|
||||
// @Produce json
|
||||
// @Param request body service.RetrievalTestRequest true "retrieval test parameters"
|
||||
// @Success 200 {object} map[string]interface{}
|
||||
// @Router /v1/chunk/retrieval_test [post]
|
||||
// @Router /api/v1/datasets/search [post]
|
||||
func (h *ChunkHandler) RetrievalTest(c *gin.Context) {
|
||||
user, errorCode, errorMessage := GetUser(c)
|
||||
if errorCode != common.CodeSuccess {
|
||||
@@ -304,13 +304,13 @@ func (h *ChunkHandler) UpdateChunk(c *gin.Context) {
|
||||
|
||||
// Allowed fields for update (exclude ID fields)
|
||||
allowedFields := map[string]bool{
|
||||
"content": true,
|
||||
"important_keywords": true,
|
||||
"questions": true,
|
||||
"available": true,
|
||||
"positions": true,
|
||||
"tag_kwd": true,
|
||||
"tag_feas": true,
|
||||
"content": true,
|
||||
"important_keywords": true,
|
||||
"questions": true,
|
||||
"available": true,
|
||||
"positions": true,
|
||||
"tag_kwd": true,
|
||||
"tag_feas": true,
|
||||
}
|
||||
for field := range rawBody {
|
||||
if field != "dataset_id" && field != "document_id" && field != "chunk_id" && !allowedFields[field] {
|
||||
|
||||
@@ -175,6 +175,7 @@ func (r *Router) Setup(engine *gin.Engine) {
|
||||
datasets.GET("", r.datasetsHandler.ListDatasets)
|
||||
datasets.POST("", r.datasetsHandler.CreateDataset)
|
||||
datasets.DELETE("", r.datasetsHandler.DeleteDatasets)
|
||||
datasets.POST("/search", r.chunkHandler.RetrievalTest)
|
||||
}
|
||||
|
||||
// Search routes
|
||||
|
||||
Reference in New Issue
Block a user