Refactor PDF extraction to use chunked upload to bypass proxy size limits
Build and Deploy / build-and-push (push) Successful in 30s
Build and Deploy / build-and-push (push) Successful in 30s
This commit is contained in:
+5
-3
@@ -199,15 +199,17 @@ export const api = {
|
||||
// ==========================================
|
||||
|
||||
extractPDF: async (file: File) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
// 1. First upload the file using the chunked uploader to bypass proxy size limits
|
||||
const fileUrl = await api.uploadAsset(file);
|
||||
|
||||
// 2. Then ask the backend to extract text from the now-local file
|
||||
const res = await fetch(`${API_URL}/sparkplug/extract`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${localStorage.getItem('auth_token')}`
|
||||
},
|
||||
body: formData
|
||||
body: JSON.stringify({ fileUrl })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.error);
|
||||
|
||||
Reference in New Issue
Block a user