fix: useful_count type + revert resp.Result (use report_json)
1. Feedback端点 类型修复 (core.go)
- 之前传 map[string]int,Update() 只处理 map[string]string/map[string]interface{}
- int 被当作 string case 处理, 被丢弃
- 修复: map[string]interface{}{"": 1}
2. IPC 搜索字段名 (lancedb_ipc.go)
- Rust send_ok 用 report_json,不是 result
- 错误改用 resp.Result 导致 IPC 结果永远为空
- 回退到 resp.ReportJSON (这是正确的)
- 加 Result 字段只是为了日志可见性(不被 Rust 填充)
验证: recall_count=6, useful_count=1 确认写入 LanceDB
This commit is contained in:
parent
8d3582046c
commit
7ac626e847
|
|
@ -268,7 +268,7 @@ func (a *API) Feedback(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
field := "useful_count"
|
||||
val := map[string]int{"$inc": 1}
|
||||
val := map[string]interface{}{"$inc": 1}
|
||||
if !req.Useful {
|
||||
field = "not_useful_count"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,12 +157,12 @@ func (rc *RustLanceDBClient) Search(table string, vector []float32, topK int, na
|
|||
Tier string `json:"tier"`
|
||||
LastRecalledAt string `json:"last_recalled_at"`
|
||||
}
|
||||
json.Unmarshal([]byte(resp.Result), &raw)
|
||||
json.Unmarshal([]byte(resp.ReportJSON), &raw)
|
||||
if len(raw) == 0 {
|
||||
log.Printf("[ipc] Search: resp.Result unmarshal gave 0 results (ReportJSON=%q), falling back to localSearch", resp.ReportJSON)
|
||||
log.Printf("[ipc] Search: resp.ReportJSON unmarshal gave 0 results, falling back to localSearch (Result=%q)", resp.Result)
|
||||
return rc.localSearch(vector, topK, namespaceFilter), nil
|
||||
}
|
||||
log.Printf("[ipc] Search: got %d results from Rust IPC (ReportJSON=%q)", len(raw), resp.ReportJSON)
|
||||
log.Printf("[ipc] Search: got %d results from Rust IPC (Result=%q)", len(raw), resp.Result)
|
||||
|
||||
// 解析时间(Rust 返回 RFC3339 字符串 → time.Time)
|
||||
parseTime := func(s string) time.Time {
|
||||
|
|
|
|||
Loading…
Reference in New Issue