-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingdata layerPertains to data layers.Pertains to data layers.needs-triage
Description
Bug Description:
The ChainlitDataLayer.create_element() method currently requires a storage client to be configured, even for elements that don't need file uploads. This prevents CustomElement instances from being persisted when cloud storage is not configured. There are many custom UI elements listed in the documentation.
To Reproduce
- Set up a Chainlit project without configuring any cloud storage.
- Follow the guide to create a data layer.
- Follow the "full example" in the (Documentation)
- Run the project and see the custom element in the UI.
- Either look at the data layer and see that no element is created, or start a new conversation and click on the previous conversation to see that the custom element is not persisted.
Current behavior (from backend/chainlit/chainlit_data_layer.py):
@queue_until_user_message()
async def create_element(self, element: "Element"):
if not self.storage_client:
logger.warning(
"Data Layer: create_element error. No cloud storage configured!"
)
return # Short-circuits, preventing ANY element from being savedImpact
- Current documentation lists two examples and neither one will work without cloud storage configured, despite neither needing file uploads. (Full Example)
- Users cannot persist CustomElement instances without configuring cloud storage (S3, GCS, or Azure)
- This is overly restrictive since CustomElement only needs database storage for its props field
- Other element types that have URLs but no binary content also cannot be persisted
Ideal Use Case
We should be able to use custom UI elements like the ones listed in the documentation without configuring cloud storage.
These elements should persist to the data layer even without cloud storage, if they contain no binary data.
Suggested Labels: bug, data-layer, enhancement
Possible Related issue:
- There is a sort of related PR that adds local storage and I can see this issue and incoming PR possibly helping their use case. (Added LocalStorageClient and a new /storage/file API route #2495)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdata layerPertains to data layers.Pertains to data layers.needs-triage