DeleteWorkingMemory deletes working memory
(c *gin.Context)
| 306 | |
| 307 | // DeleteWorkingMemory deletes working memory |
| 308 | func (h *MemoryHandler) DeleteWorkingMemory(c *gin.Context) { |
| 309 | ctx := c.Request.Context() |
| 310 | id := c.Param("id") |
| 311 | |
| 312 | if err := (*h.store).Delete(ctx, "working_memory", id); err != nil { |
| 313 | if errors.Is(err, store.ErrNotFound) { |
| 314 | c.JSON(http.StatusNotFound, gin.H{ |
| 315 | "success": false, |
| 316 | "error": gin.H{ |
| 317 | "code": "not_found", |
| 318 | "message": "Working memory not found", |
| 319 | }, |
| 320 | }) |
| 321 | return |
| 322 | } |
| 323 | c.JSON(http.StatusInternalServerError, gin.H{ |
| 324 | "success": false, |
| 325 | "error": gin.H{ |
| 326 | "code": "internal_error", |
| 327 | "message": "Failed to delete working memory: " + err.Error(), |
| 328 | }, |
| 329 | }) |
| 330 | return |
| 331 | } |
| 332 | |
| 333 | logging.Info(ctx, "working_memory.deleted", map[string]any{ |
| 334 | "id": id, |
| 335 | }) |
| 336 | |
| 337 | c.Status(http.StatusNoContent) |
| 338 | } |
| 339 | |
| 340 | // ClearWorkingMemory clears working memory |
| 341 | func (h *MemoryHandler) ClearWorkingMemory(c *gin.Context) { |