dash-ai-chatbot
Adds the Asyntai AI chat assistant to a Plotly Dash app. The assistant answers visitor questions from your own content, day and night, in more than 80 languages.
Free and open source. Works on every Asyntai plan, including the free plan.
- Requires Dash 2.0 or newer and Python 3.10 or newer
- Documentation: https://asyntai.com/documentation/integrations/plotly-dash/
Install
pip install dash-ai-chatbot
Add one line after you create the app:
from dash import Dash, html
import dash_ai_chatbot
app = Dash(__name__)
app.layout = html.Div("Hello")
dash_ai_chatbot.init_app(app, widget_id="asyntai_ab12cd34")
if __name__ == "__main__":
app.run()
You get the ID from the Install page of your Asyntai dashboard. You can paste the whole snippet; the package keeps only the ID.
That is all. The chat button appears on every page of the app, including multi-page apps.
No code change (Dash 3 and later)
On Dash 3 and later the package also works with no code change. Install it and set one environment variable:
ASYNTAI_WIDGET_ID=asyntai_ab12cd34
Every Dash app that runs with that variable gets the chat. Without the variable the package does nothing.
Keep the ID out of the code
Leave out widget_id and the package reads ASYNTAI_WIDGET_ID each time the
page is built:
dash_ai_chatbot.init_app(app)
Options
dash_ai_chatbot.init_app(
app,
widget_id="asyntai_ab12cd34", # or the whole snippet; empty or invalid = chat off
script_url=None, # change only if Asyntai support asks you to
)
script_url can also come from the ASYNTAI_SCRIPT_URL environment variable.
Only an https address is accepted.
How it works
Dash serves one HTML page for the whole app. The package puts a small script just before the closing body tag of that page. The script waits for the page to finish loading, then fetches the chat widget from Asyntai, so your app draws first and its speed is unchanged.
The widget ID and the script address travel to the browser on a data
attribute, never inside the script. The package works with a custom
index_string, with a subclass that overrides interpolate_index, and with
url_base_pathname. It never adds the widget twice.
Tests
pip install -e . pytest
pytest
Support
Licence
MIT. See LICENSE.
Metadata
Release files for dash-ai-chatbot 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dash_ai_chatbot-1.0.0.tar.gz | 10.0 kB | Without provenance | Details for dash_ai_chatbot-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dash_ai_chatbot-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for dash_ai_chatbot-1.0.0-py3-none-any.whl |
Total release size: 17.6 kB
Release files / dash_ai_chatbot-1.0.0.tar.gz
| Download URL | dash_ai_chatbot-1.0.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf29726b27e16d44ef800cbae901621222ff2003a02eadbb9803331a8fae55fa
|
|
BLAKE2b-256 checksum How to use checksums |
59d9c2a0c1b54bc36e4cc4f597886f6134f9243ffbb75bcc19f42fa638798938
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / dash_ai_chatbot-1.0.0-py3-none-any.whl
| Download URL | dash_ai_chatbot-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1021a16f9703337342a93c0e60a46ee7c1087b826968ae7aeb185e5674682960
|
|
BLAKE2b-256 checksum How to use checksums |
fb998e9167c629d8fcd4f07d048f65315d3c9a6d98b3626974e28d86f1d60876
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for dash-ai-chatbot 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.