feat: implement batch move and delete functionality for documents and FAQs

This commit is contained in:
mlogclub
2026-06-02 16:13:08 +08:00
parent 1bdc1cb2b6
commit 842f827c86
12 changed files with 727 additions and 2 deletions
+34
View File
@@ -1532,6 +1532,12 @@ export type UpdateKnowledgeFAQPayload = CreateKnowledgeFAQPayload & {
id: number
}
export type BatchMoveKnowledgeContentPayload = {
knowledgeBaseId: number
directoryId: number
ids: number[]
}
export type KnowledgeDirectory = {
id: number
knowledgeBaseId: number
@@ -1690,6 +1696,20 @@ export function deleteKnowledgeDocument(id: number) {
})
}
export function batchMoveKnowledgeDocuments(payload: BatchMoveKnowledgeContentPayload) {
return request<void>("/api/dashboard/knowledge-document/batch_move", {
method: "POST",
body: JSON.stringify(payload),
})
}
export function batchDeleteKnowledgeDocuments(ids: number[]) {
return request<void>("/api/dashboard/knowledge-document/batch_delete", {
method: "POST",
body: JSON.stringify({ ids }),
})
}
export function buildKnowledgeDocumentIndex(documentId: number) {
return request<void>("/api/dashboard/knowledge-retrieve/build", {
method: "POST",
@@ -1730,6 +1750,20 @@ export function deleteKnowledgeFAQ(id: number) {
})
}
export function batchMoveKnowledgeFAQs(payload: BatchMoveKnowledgeContentPayload) {
return request<void>("/api/dashboard/knowledge-faq/batch_move", {
method: "POST",
body: JSON.stringify(payload),
})
}
export function batchDeleteKnowledgeFAQs(ids: number[]) {
return request<void>("/api/dashboard/knowledge-faq/batch_delete", {
method: "POST",
body: JSON.stringify({ ids }),
})
}
function downloadBlob(blob: Blob, filename: string) {
const url = URL.createObjectURL(blob)
const link = document.createElement("a")