Unstructured Upsert bug (#2628)

* Unstructured Upsert bug
When upserting with the API, the uploaded files are of type pdfFile, txtFile, etc.
but the code reads only fileObject which is the uploaded file using the button

* Update UnstructuredFile.ts

fixed linting error

---------

Co-authored-by: Mohamed Akram <makram@ntgclarity.com>
This commit is contained in:
Mohamed Akram
2024-06-14 04:39:46 +03:00
committed by GitHub
parent f2c6a1988f
commit c34eb8ee15
@@ -448,7 +448,16 @@ class UnstructuredFile_DocumentLoaders implements INode {
if (_omitMetadataKeys) {
omitMetadataKeys = _omitMetadataKeys.split(',').map((key) => key.trim())
}
const fileBase64 = nodeData.inputs?.fileObject as string
// give priority to upload with upsert then to fileObject (upload from UI component)
const fileBase64 =
nodeData.inputs?.pdfFile ||
nodeData.inputs?.txtFile ||
nodeData.inputs?.yamlFile ||
nodeData.inputs?.docxFile ||
nodeData.inputs?.jsonlinesFile ||
nodeData.inputs?.csvFile ||
nodeData.inputs?.jsonFile ||
(nodeData.inputs?.fileObject as string)
const obj: UnstructuredLoaderOptions = {
apiUrl: unstructuredAPIUrl,