Add native DOCX parser via Mammoth library and improve AI experience extraction
This commit is contained in:
@@ -110,14 +110,25 @@ export const ProfileSettings: React.FC<ProfileSettingsProps> = ({
|
||||
setParseError(null);
|
||||
|
||||
try {
|
||||
const text = await file.text();
|
||||
let bodyData: any = {
|
||||
fileName: file.name,
|
||||
llmConfig: profile.llmConfig
|
||||
};
|
||||
|
||||
if (file.name.endsWith('.docx') || file.name.endsWith('.doc')) {
|
||||
const arrayBuffer = await file.arrayBuffer();
|
||||
const base64 = btoa(
|
||||
new Uint8Array(arrayBuffer).reduce((data, byte) => data + String.fromCharCode(byte), '')
|
||||
);
|
||||
bodyData.resumeBase64 = base64;
|
||||
} else {
|
||||
bodyData.resumeText = await file.text();
|
||||
}
|
||||
|
||||
const res = await fetch('/api/gemini/parse-resume', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
resumeText: text,
|
||||
llmConfig: profile.llmConfig
|
||||
})
|
||||
body: JSON.stringify(bodyData)
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
Reference in New Issue
Block a user