diff --git a/go/internal/api/server.go b/go/internal/api/server.go index c70ec84..0880ce7 100644 --- a/go/internal/api/server.go +++ b/go/internal/api/server.go @@ -149,7 +149,7 @@ func NewServer() http.Handler { EpisodeID: input.EpisodeID, }) - // 回写蒸馏产物到记忆库(LanceDB) +// 回写蒸馏产物到记忆库(LanceDB) for _, fact := range result.Facts { mem := models.MemoryRecord{ ID: fmt.Sprintf("mem_%d", time.Now().UnixNano()), @@ -163,6 +163,7 @@ func NewServer() http.Handler { CreatedAt: time.Now(), UpdatedAt: time.Now(), DerivedFrom: input.EpisodeID, + Freshness: "fresh", } if err := ldb.InsertMemory(mem); err != nil { log.Printf("[distill] commit fact failed: %v", err) @@ -653,6 +654,9 @@ func NewServer() http.Handler { http.NotFound(w, r) } }) + // GET /api/v1/memories — list all memories (zero-vector search, for plugin compat) + mux.HandleFunc("/api/v1/memories", api.ListMemories) + // /api/v1/memory/{id}/versions — existing version history endpoint mux.HandleFunc("/api/v1/memory/", func(w http.ResponseWriter, r *http.Request) { if r.Method == "GET" { adminAPI.Versions(w, r) diff --git a/go/internal/storage/recall.go b/go/internal/storage/recall.go index 216eaa9..ce89792 100644 --- a/go/internal/storage/recall.go +++ b/go/internal/storage/recall.go @@ -382,6 +382,7 @@ func (p *RecallPipeline) incrementRecallCount(results []models.RecallResult) { _ = p.lancedb.Update("memories", r.ID, map[string]any{ "recall_count": map[string]string{"$inc": "1"}, "last_recalled_at": now, + "freshness": "verified", }) } }