Open thucpn opened 1 week ago
Latest commit: 4a069f1a165b4a2dfbe73ade5c5f1a013348bca1
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The changes introduce significant enhancements to the file handling and processing capabilities within the FastAPI application. A new LLamaCloudFileController
class is added for cloud interactions, and the FileController
class is refactored into PrivateFileService
. Import statements and method signatures are updated across various modules, and background task handling is improved in the chat functionality. Additionally, metadata processing and document handling have been refined to support various index types and file sources.
Files/Groups | Summary |
---|---|
templates/types/streaming/fastapi/app/api/routers/chat.py |
Added imports, process_response_nodes function, updated chat endpoint for background tasks. |
templates/types/streaming/fastapi/app/api/routers/models.py |
Introduced LLamaCloudFileController , updated imports, added LlamaCloudFile , and get_download_files . |
templates/types/streaming/fastapi/app/api/controllers/file.py |
Reordered imports, modified function signatures, removed file_metadata_func , updated document handling. |
templates/types/streaming/fastapi/app/api/services/file.py |
Refactored FileController to PrivateFileService , updated methods and imports for file processing. |
templates/types/streaming/fastapi/app/api/controllers/llama_cloud.py |
Added LLamaCloudFileController class with methods for file operations. |
templates/types/streaming/fastapi/app/api/routers/upload.py |
Updated imports and method calls to use PrivateFileService instead of FileController . |
templates/types/streaming/fastapi/app/engine/generate.py |
Reordered imports, added metadata field "is_local_file" to documents in generate_datasource . |
templates/components/vectordbs/python/none/generate.py |
Reordered imports, updated generate_datasource function to set "is_local_file" metadata field. |
sequenceDiagram
participant Client
participant FastAPI
participant LlamaCloudFileController
participant PrivateFileService
participant BackgroundTasks
Client->>FastAPI: Upload file
FastAPI->>PrivateFileService: Call process_file
PrivateFileService->>LlamaCloudFileController: Download file if needed
LlamaCloudFileController-->>PrivateFileService: Return file details
PrivateFileService->>FastAPI: Process and store file
FastAPI->>BackgroundTasks: Initiate background processing task
BackgroundTasks->>FastAPI: Confirm task initiation
FastAPI-->>Client: Return success response
In the land of code so bright,
Files and tasks now take flight,
Cloud and local, side by side,
In harmony, they now reside.
FastAPI calls with joy,
As LlamaCloud serves file employ.
🍂 Code dances in delight. 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@marcusschiesser @leehuwuj I have updated code to save LlamaCloud file in local and return the local url. Please help me have a look at the PR again
TS code looks good - @leehuwuj please check the python code and then you can merge it
Summary by CodeRabbit
New Features
LLamaCloudFileController
for managing cloud file operations, including retrieving, downloading, and handling file paths.Enhancements
chat
endpoint to support background task processing.is_local_file
metadata field to document generation processes.Refactor
FileController
toPrivateFileService
and updated associated method signatures and logic.upload_file
to usePrivateFileService
.Bug Fixes
preprocess_base64_file
.Code Clean-Up