feat(server): 扩展知识库服务,添加knowledge API端点和schema定义,前端新增knowledge服务模块
This commit is contained in:
@@ -1,12 +1,23 @@
|
||||
import { apiRequest } from './api.js'
|
||||
|
||||
export function fetchKnowledgeLibrary() {
|
||||
return apiRequest('/knowledge/library')
|
||||
}
|
||||
|
||||
export function fetchKnowledgeDocument(documentId) {
|
||||
return apiRequest(`/knowledge/documents/${documentId}`)
|
||||
}
|
||||
export function fetchKnowledgeLibrary() {
|
||||
return apiRequest('/knowledge/library')
|
||||
}
|
||||
|
||||
export function fetchLlmWikiDocumentDetail(documentId) {
|
||||
return apiRequest(`/knowledge/llm-wiki/documents/${documentId}`)
|
||||
}
|
||||
|
||||
export function updateLlmWikiDocumentSummary(documentId, payload) {
|
||||
return apiRequest(`/knowledge/llm-wiki/documents/${documentId}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchKnowledgeDocument(documentId) {
|
||||
return apiRequest(`/knowledge/documents/${documentId}`)
|
||||
}
|
||||
|
||||
export function fetchKnowledgeOnlyOfficeConfig(documentId) {
|
||||
return apiRequest(`/knowledge/documents/${documentId}/onlyoffice-config`)
|
||||
@@ -23,15 +34,26 @@ export function uploadKnowledgeDocument({ folder, file }) {
|
||||
)
|
||||
}
|
||||
|
||||
export function deleteKnowledgeDocument(documentId) {
|
||||
return apiRequest(`/knowledge/documents/${documentId}`, {
|
||||
method: 'DELETE'
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchKnowledgeDocumentBlob(documentId, disposition = 'inline') {
|
||||
return apiRequest(`/knowledge/documents/${documentId}/content?disposition=${disposition}`, {
|
||||
responseType: 'blob',
|
||||
export function deleteKnowledgeDocument(documentId) {
|
||||
return apiRequest(`/knowledge/documents/${documentId}`, {
|
||||
method: 'DELETE'
|
||||
})
|
||||
}
|
||||
|
||||
export function syncKnowledgeDocumentToLlmWiki({ folder, documentId, force = false }) {
|
||||
return apiRequest('/knowledge/llm-wiki/sync', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
folder,
|
||||
document_ids: documentId ? [documentId] : [],
|
||||
force
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchKnowledgeDocumentBlob(documentId, disposition = 'inline') {
|
||||
return apiRequest(`/knowledge/documents/${documentId}/content?disposition=${disposition}`, {
|
||||
responseType: 'blob',
|
||||
contentType: null
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user