ReadFile 读取指定记忆文件内容 name 为相对于 memoryPath 的路径,例如 "project_notes.md" 或 "user/alice.md"
(ctx context.Context, name string)
| 88 | // ReadFile 读取指定记忆文件内容 |
| 89 | // name 为相对于 memoryPath 的路径,例如 "project_notes.md" 或 "user/alice.md" |
| 90 | func (m *Manager) ReadFile(ctx context.Context, name string) (string, error) { |
| 91 | if name == "" { |
| 92 | return "", errors.New("memory.ReadFile: name cannot be empty") |
| 93 | } |
| 94 | path := m.resolvePath(name) |
| 95 | return m.backend.Read(ctx, path, 0, 0) |
| 96 | } |
| 97 | |
| 98 | // AppendNote 以追加模式写入一条记忆 |
| 99 | // file: 目标文件名(相对于 memoryPath) |