refactor: rerank item

This commit is contained in:
jialin
2024-11-22 10:00:34 +08:00
parent e05ec3d2d5
commit 419f1e07d1
15 changed files with 250 additions and 182 deletions
+2 -1
View File
@@ -7,7 +7,8 @@ export default function readHtmlContent(file: File): Promise<string> {
const parser = new DOMParser();
const doc = parser.parseFromString(fileContent, 'text/html');
const textContent = doc.body.textContent || '';
resolve(textContent);
const cleanedTextContent = textContent.replace(/[\t\n]/g, '').trim();
resolve(cleanedTextContent);
};
reader.onerror = (error) => reject(error);
reader.readAsText(file);