Files
memoryweave/go/internal/models/memory.go
T
2026-05-28 17:35:25 +08:00

56 lines
2.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Package models 定义织忆 MemoryWeave 的核心数据模型。
package models
import "time"
// MemoryRecord 织忆中的单条记忆(存储在 LanceDB memories 表中)。
type MemoryRecord struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
Namespace string `json:"namespace"`
Content string `json:"content"`
Category string `json:"category"` // system_fact, user_pref, proj_context, tool_usage, code_snippet
Vector []float32 `json:"vector"` // bge-m3 1024维,L2归一化
Tier string `json:"tier"` // normal, core(core永不衰减)
QualityScore float64 `json:"quality_score"`
RecallCount int `json:"recall_count"`
Freshness string `json:"freshness"` // fresh, stale, verified
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
IsDeleted bool `json:"is_deleted"`
}
// EpisodeRecord 原始对话/任务日志(存储在 LanceDB episodes 表中)。
type EpisodeRecord struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
Namespace string `json:"namespace"`
Content string `json:"content"`
Category string `json:"category"`
CreatedAt time.Time `json:"created_at"`
}
// TombstoneRecord 已删除/废弃记忆的墓碑记录。
type TombstoneRecord struct {
ID string `json:"id"`
OriginalID string `json:"original_id"`
Reason string `json:"reason"` // deprecated, merged, corrected, evicted
CreatedAt time.Time `json:"created_at"`
}
// RecallResult recall 接口返回的单条结果。
type RecallResult struct {
ID string `json:"id"`
Content string `json:"content"`
Category string `json:"category"`
Score float64 `json:"score"`
Timestamp string `json:"timestamp"`
}
// RerankResult rerank 重排后的单条结果。
type RerankResult struct {
Index int `json:"index"`
Score float64 `json:"score"`
Text string `json:"text"`
}