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

Function NewManager

pkg/memory/memory.go:56–76  ·  view source on GitHub ↗

NewManager 创建 Memory 管理器

(cfg *ManagerConfig)

Source from the content-addressed store, hash-verified

54
55// NewManager 创建 Memory 管理器
56func NewManager(cfg *ManagerConfig) (*Manager, error) {
57 if cfg == nil {
58 return nil, errors.New("memory.ManagerConfig cannot be nil")
59 }
60 if cfg.Backend == nil {
61 return nil, errors.New("memory.Manager requires a non-nil Backend")
62 }
63
64 memoryPath := cfg.MemoryPath
65 if memoryPath == "" {
66 memoryPath = "/memories/"
67 }
68
69 // 规范化路径,统一为以 / 开头,以 / 结尾
70 memoryPath = normalizeDir(memoryPath)
71
72 return &Manager{
73 backend: cfg.Backend,
74 memoryPath: memoryPath,
75 }, nil
76}
77
78// MemoryPath 返回记忆根路径
79func (m *Manager) MemoryPath() string {

Callers 1

createMemoryToolsMethod · 0.92

Calls 1

normalizeDirFunction · 0.85

Tested by

no test coverage detected