import { apiRequest } from './api.js' export function fetchKnowledgeLibrary() { return apiRequest('/knowledge/library') } export function fetchKnowledgeDocument(documentId) { return apiRequest(`/knowledge/documents/${documentId}`) } export function uploadKnowledgeDocument({ folder, file }) { return apiRequest( `/knowledge/documents?folder=${encodeURIComponent(folder)}&filename=${encodeURIComponent(file.name)}`, { method: 'POST', body: file, contentType: file.type || 'application/octet-stream' } ) } 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', contentType: null }) }