Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Add support for importing JSON files #110

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zebfross
Copy link

@zebfross zebfross commented Jul 3, 2023

This change adds support for importing JSON files using Langchain's JSONLoader. Here are the major changes:

  • Created new routes and types in the backend-server
  • Added appropriate frontend views
  • Added HandleJsonDataSource.php that handles the uploaded files. Along with json files, I also allow zip files to be uploaded. Zip support required adding the "zip" php extension to the docker file.
  • Added jsonHandler.ts to the llm-server that imports the json files. It uses Langchain's JSONLoader to import the files as documents.

zebfross and others added 2 commits July 3, 2023 13:00
This change adds support for importing JSON files using Langchain's JSONLoader.  Here are the major changes:
- Created new routes and types in the backend-server
- Added appropriate frontend views
- Added HandleJsonDataSource.php that handles the uploaded files.   Along with json files, I also allow zip files to be uploaded.  Zip support required adding the "zip" php extension to the docker file.
- Added jsonHandler.ts to the llm-server that imports the json files.  It uses Langchain's JSONLoader to import the files as documents.
@gharbat
Copy link
Member

gharbat commented Jul 4, 2023

Wow!

Thanks for the amazing contribution! Will take a look at it tonight.

const directoryLoader = new DirectoryLoader(
'/app/shared_data/' + shared_folder,
{
'.json': (path: string | Blob) => new JSONLoader(path),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are compressing the files into single .zip folder, I think we should either extract here or not compress in https://github.com/openchatai/OpenChat/pull/110/files#diff-42c70911d6785561115aeb3cbeb958a0427e6cd6fc6a84ce1ceb85ec6dbcd853R42

@inluxc
Copy link

inluxc commented Jul 27, 2023

How is this coming?
I would love to load products list.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants