diff --git a/.env.example b/.env.example index 62dacae8..b1ef7b84 100644 --- a/.env.example +++ b/.env.example @@ -26,3 +26,6 @@ TIDB_SSL=true # # Notice: this variable will be deprecated in the future. EMBEDDING_MAX_TOKENS=2048 + +# JS Widgets: if you want to use JS widgets, you need to set the following variables to enable CORS. +# BACKEND_CORS_ORIGINS=['http://localhost:3000', 'https://your-domain.com'] \ No newline at end of file diff --git a/frontend/app/src/pages/docs/javascript.mdx b/frontend/app/src/pages/docs/javascript.mdx index 0cccdd82..e0d833a4 100644 --- a/frontend/app/src/pages/docs/javascript.mdx +++ b/frontend/app/src/pages/docs/javascript.mdx @@ -2,6 +2,19 @@ What if you could integrate a conversational search window into your website to facilitate instant responses to product-related queries? With the embeddable JavaScript snippet, you can do just that. This feature allows you to copy and embed a simple JavaScript code snippet into your website, typically placed at the bottom right corner of your site. +## Pre-requisites + +If you want to embed the JavaScript snippet into your other website, you need to enable it in `.env` file. + +* Step 1: Enable the JavaScript Widget + +```bash +# JS Widgets: if you want to use JS widgets, you need to set the following variables to enable CORS. +BACKEND_CORS_ORIGINS=['http://localhost:3000', 'https://your-domain.com'] +``` + +* Step 2: Restart your service + ## How to Embed To embed the JavaScript snippet, follow these steps: