Spaces:
Sleeping
Sleeping
File size: 1,272 Bytes
c768df1 55d5019 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | const API_BASE = '/api/resume';
export async function uploadResume(file, targetRole, roastLevel) {
const formData = new FormData();
formData.append('resume', file);
formData.append('targetRole', targetRole);
formData.append('roastLevel', roastLevel);
const res = await fetch(`${API_BASE}/upload`, {
method: 'POST',
body: formData,
});
if (!res.ok) {
const err = await res.json();
throw new Error(err.error || 'Upload failed');
}
return res.json();
}
export async function analyzeText(resumeText, targetRole, roastLevel) {
const res = await fetch(`${API_BASE}/text`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ resumeText, targetRole, roastLevel }),
});
if (!res.ok) {
const err = await res.json();
throw new Error(err.error || 'Analysis failed');
}
return res.json();
}
export async function transformResume(resumeText, targetRole) {
const res = await fetch(`${API_BASE}/transform`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ resumeText, targetRole }),
});
if (!res.ok) {
const err = await res.json();
throw new Error(err.error || 'Transform failed');
}
return res.json();
}
|