Spaces:
Sleeping
Sleeping
File size: 565 Bytes
7949d20 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import { get, del, uploadFile } from './client.js'
export async function loadDocumentsFromApi(convId) {
try {
return await get(`/api/documents?conversation_id=${convId}`)
} catch {
return []
}
}
export async function uploadDocumentToApi(file, convId) {
try {
return await uploadFile('/api/documents/upload', file, { conversation_id: convId })
} catch {
return null
}
}
export async function deleteDocumentFromApi(docId, convId) {
try {
await del(`/api/documents/${docId}?conversation_id=${convId}`)
} catch { /* ignore */ }
}
|