mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-16 07:14:29 -04:00
fix: enhance loadJson in LlamaParseReader to handle URL inputs correctly (#1936)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/cloud": patch
|
||||
---
|
||||
|
||||
Improve the loadJson function in LlamaParseReader to align with loadData by allowing URL inputs. Ensures s3://, http://, and https:// paths are not treated as local file paths.
|
||||
@@ -585,7 +585,13 @@ export class LlamaParseReader extends FileReader {
|
||||
filePathOrContent: string | Uint8Array,
|
||||
): Promise<Record<string, any>[]> {
|
||||
let jobId;
|
||||
const isFilePath = typeof filePathOrContent === "string";
|
||||
const isFilePath =
|
||||
typeof filePathOrContent === "string" &&
|
||||
!(
|
||||
filePathOrContent.startsWith("s3://") ||
|
||||
filePathOrContent.startsWith("http://") ||
|
||||
filePathOrContent.startsWith("https://")
|
||||
);
|
||||
try {
|
||||
const data = isFilePath
|
||||
? await fs.readFile(filePathOrContent)
|
||||
|
||||
Reference in New Issue
Block a user