Spaces:
Runtime error
Runtime error
matt HOFFNER
commited on
Commit
Β·
d4cd819
1
Parent(s):
e82c85b
fix plain text embed
Browse files
src/components/FileLoader.jsx
CHANGED
@@ -45,7 +45,13 @@ export const FileLoader = () => {
|
|
45 |
if (file.type === "application/pdf") {
|
46 |
text = await Pdf.getPDFText(URL.createObjectURL(blob));
|
47 |
} else {
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
const response = await fetch('/api/docHandle', {
|
51 |
method: 'POST',
|
@@ -55,7 +61,7 @@ export const FileLoader = () => {
|
|
55 |
console.log('handleDocs-getModels: ', docChat);
|
56 |
const id = await db.docs.add({
|
57 |
fileName: file.name || '',
|
58 |
-
fileSourceData:
|
59 |
model: docChat,
|
60 |
});
|
61 |
setUploadStatus("Embedding Completed");
|
|
|
45 |
if (file.type === "application/pdf") {
|
46 |
text = await Pdf.getPDFText(URL.createObjectURL(blob));
|
47 |
} else {
|
48 |
+
let reader = new FileReader();
|
49 |
+
|
50 |
+
reader.addEventListener('load', function (e) {
|
51 |
+
text = e.target.result;
|
52 |
+
});
|
53 |
+
|
54 |
+
reader.readAsBinaryString(file);
|
55 |
}
|
56 |
const response = await fetch('/api/docHandle', {
|
57 |
method: 'POST',
|
|
|
61 |
console.log('handleDocs-getModels: ', docChat);
|
62 |
const id = await db.docs.add({
|
63 |
fileName: file.name || '',
|
64 |
+
fileSourceData: text,
|
65 |
model: docChat,
|
66 |
});
|
67 |
setUploadStatus("Embedding Completed");
|