feat: delete AI reports, Super Contexte versions, and KB entries

- database.py: add delete_ai_report(), delete_reasoning_state(), delete_kb_entry()
- reasoning.py: DELETE /api/reasoning/reports/{id}
- knowledge.py: DELETE /api/knowledge/history/{id} and /entries/{id}
- useApi.ts: useDeleteAiReport, useDeleteReasoningState, useDeleteKbEntry hooks
- RapportIA.tsx: trash icon on hover in archived reports sidebar
- SuperContexte.tsx: trash icon on hover for history versions and KB entries;
  both propagate onDelete through CategorySection down to KbEntry

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-17 00:10:41 +02:00
parent 22687dfd03
commit a3fb486477
6 changed files with 174 additions and 33 deletions

View File

@@ -546,3 +546,30 @@ export const usePatchKbEntryStatus = () => {
onSuccess: () => qc.invalidateQueries({ queryKey: ['knowledge-entries'] }),
})
}
export const useDeleteAiReport = () => {
const qc = useQueryClient()
return useMutation({
mutationFn: (id: number) => api.delete(`/reasoning/reports/${id}`).then(r => r.data),
onSuccess: () => qc.invalidateQueries({ queryKey: ['ai-reports-list'] }),
})
}
export const useDeleteReasoningState = () => {
const qc = useQueryClient()
return useMutation({
mutationFn: (id: number) => api.delete(`/knowledge/history/${id}`).then(r => r.data),
onSuccess: () => {
qc.invalidateQueries({ queryKey: ['knowledge-history'] })
qc.invalidateQueries({ queryKey: ['knowledge-state'] })
},
})
}
export const useDeleteKbEntry = () => {
const qc = useQueryClient()
return useMutation({
mutationFn: (id: number) => api.delete(`/knowledge/entries/${id}`).then(r => r.data),
onSuccess: () => qc.invalidateQueries({ queryKey: ['knowledge-entries'] }),
})
}