Streamlit component that allows you to bookmark chat messages in your apps
Project description
streamlit-bookmark
Here is a Streamlit component that allows you to bookmark chat messages in your apps, for later reference or anything else. The code is based on streamlit-feedback by Trubrics
Install
pip install streamlit-bookmark
Examples
- See the streamlit_app_example.py.
Usage
This component holds a single function:
from streamlit_bookmark import streamlit_bookmark
bookmark_state = streamlit_bookmark(on_submit=some_callback_function,
key=SOME_COMPONENT_KEY,
disable_component=True)
bookmark_state
# ===> {'bookmark': True}
Could be used with these parameters:
def streamlit_bookmark(
on_submit=None,
disable_component=None,
key=None,
):
"""Creates a new instance of "streamlit_bookmark". Receives the current bookmark status for a given Streamlit compnent and calls a function upon submission.
Parameters
----------
on_submit: callable
An optional callback invoked when feedback is submitted. This function must accept at least one argument, the feedback response dict,
allowing you to save the feedback to a database for example. Additional arguments can be specified using `args` and `kwargs`.
disable_component: str
An optional boolean to disable the component. Can be used to pass state from one component to another.
key: str or None
An optional key that uniquely identifies this component. If this is
None, and the component's arguments are changed, the component will
be re-mounted in the Streamlit frontend and lose its current state.
Returns
-------
dict
The user response
"""
For the code example, see here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_bookmark-0.1.2-py3-none-any.whl.
File metadata
- Download URL: streamlit_bookmark-0.1.2-py3-none-any.whl
- Upload date:
- Size: 574.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
219ac0ab4bb4a5ac4467acdbdcfa3c42313d30c67cab6d511d0fe8f2d04494ee
|
|
| MD5 |
a337bd9353e819f9b9c86ab1bc5fa77a
|
|
| BLAKE2b-256 |
2d233f2f6753463c578466d1714cd2a7eb2984bc42ab054e95ca074628d776c8
|