Refactor context command (#13952)

### What problem does this PR solve?

Refactor context search command

### Type of change

- [x] Refactoring

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-04-07 13:59:27 +08:00
committed by GitHub
parent 424aee5bec
commit 9ac5d28f06
3 changed files with 228 additions and 26 deletions

View File

@@ -114,15 +114,15 @@ func (c *RAGFlowClient) ContextSearch(cmd *Command) (ResponseIf, error) {
}
}
threshold := 0.0
if cmd.Params["threshold"] != nil {
threshold, ok = cmd.Params["threshold"].(float64)
if !ok {
return nil, fmt.Errorf("fail to convert 'threshold' to float64")
}
}
//threshold := 0.0
//if cmd.Params["threshold"] != nil {
// threshold, ok = cmd.Params["threshold"].(float64)
// if !ok {
// return nil, fmt.Errorf("fail to convert 'threshold' to float64")
// }
//}
fmt.Printf("search query: %s, path: %s, threshold: %f, number: %d\n", query, path, threshold, number)
fmt.Printf("search query: %s, path: %s, number: %d\n", query, path, number)
// Convert to response
var response ContextSearchResponse