LoadToolCallRecords 加载工具调用记录
(ctx context.Context, agentID string)
| 181 | |
| 182 | // LoadToolCallRecords 加载工具调用记录 |
| 183 | func (js *JSONStore) LoadToolCallRecords(ctx context.Context, agentID string) ([]types.ToolCallRecord, error) { |
| 184 | js.mu.RLock() |
| 185 | defer js.mu.RUnlock() |
| 186 | |
| 187 | var records []types.ToolCallRecord |
| 188 | path := filepath.Join(js.agentDir(agentID), "tool_records.json") |
| 189 | if err := js.loadJSON(path, &records); err != nil { |
| 190 | return nil, err |
| 191 | } |
| 192 | |
| 193 | if records == nil { |
| 194 | records = []types.ToolCallRecord{} |
| 195 | } |
| 196 | |
| 197 | return records, nil |
| 198 | } |
| 199 | |
| 200 | // SaveSnapshot 保存快照 |
| 201 | func (js *JSONStore) SaveSnapshot(ctx context.Context, agentID string, snapshot types.Snapshot) error { |