feat: add Clear History button to delete all consumed instructions
- Backend: instruction_service.clear_consumed() bulk-deletes consumed rows - Backend: DELETE /api/instructions/consumed route (preserves pending) - Frontend: Clear button in consumed panel header (hidden when empty) - Frontend: SSE handler for history.cleared event - instant UI update - Frontend: api.clearConsumed() fetch wrapper
This commit is contained in:
@@ -57,6 +57,14 @@ def update_instruction(instruction_id: str, body: UpdateInstructionRequest):
|
||||
return InstructionCreateResponse(item=item)
|
||||
|
||||
|
||||
@router.delete("/consumed", status_code=200)
|
||||
def clear_consumed_instructions():
|
||||
"""Delete all consumed instructions. Pending instructions are never affected."""
|
||||
count = instruction_service.clear_consumed()
|
||||
event_service.broadcast("history.cleared", {"count": count})
|
||||
return {"cleared": count}
|
||||
|
||||
|
||||
@router.delete("/{instruction_id}", status_code=204)
|
||||
def delete_instruction(instruction_id: str):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user