MCPcopy Create free account
hub / github.com/astercloud/aster / namespaceFromMeta

Method namespaceFromMeta

pkg/memory/semantic.go:206–234  ·  view source on GitHub ↗
(meta map[string]any)

Source from the content-addressed store, hash-verified

204}
205
206func (sm *SemanticMemory) namespaceFromMeta(meta map[string]any) string {
207 if meta == nil {
208 return ""
209 }
210 scope := sm.cfg.NamespaceScope
211 switch scope {
212 case "user":
213 if v, ok := meta["user_id"].(string); ok && v != "" {
214 return "users/" + v
215 }
216 case "project":
217 if v, ok := meta["project_id"].(string); ok && v != "" {
218 return "projects/" + v
219 }
220 case "resource":
221 user := ""
222 if u, ok := meta["user_id"].(string); ok && u != "" {
223 user = "users/" + u + "/"
224 }
225 if pid, ok := meta["project_id"].(string); ok && pid != "" {
226 return user + "projects/" + pid
227 }
228 if rid, ok := meta["resource_id"].(string); ok && rid != "" {
229 return user + "resources/" + rid
230 }
231 }
232 // 默认命名空间
233 return ""
234}
235
236// SearchWithConfidenceFilter 执行检索并按置信度过滤。
237// minConfidence: 最低置信度阈值(0.0-1.0)

Callers 2

indexInternalMethod · 0.95
SearchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected