diff --git a/.github/workflows/lib-jims-widget.yml b/.github/workflows/lib-jims-widget.yml new file mode 100644 index 00000000..5542e0c7 --- /dev/null +++ b/.github/workflows/lib-jims-widget.yml @@ -0,0 +1,55 @@ +# This file was automatically generated by uv-workspace-codegen +# For more information, see: https://github.com/epoch8/uv-workspace-codegen/blob/master/README.md +# Do not edit this file manually - changes will be overwritten + +name: Test lib jims-widget + +on: + pull_request: + paths: + - "libs/jims-widget/**" + push: + branches: [master] + paths: + - "libs/jims-widget/**" + - "pyproject.toml" + - "uv.lock" + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v6 + + - name: Install + shell: bash + run: | + cd libs/jims-widget + uv sync --all-groups + + - name: Run tests + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + shell: bash + run: | + uv run pytest libs/jims-widget/ + + - name: Check formatting + shell: bash + run: | + uv run ruff check libs/jims-widget + + - name: Check typing + shell: bash + run: | + uv run mypy -p jims_widget \ No newline at end of file diff --git a/.github/workflows/publish-jims-widget.yml b/.github/workflows/publish-jims-widget.yml new file mode 100644 index 00000000..2c096b25 --- /dev/null +++ b/.github/workflows/publish-jims-widget.yml @@ -0,0 +1,72 @@ +# This file was automatically generated by uv-workspace-codegen +# For more information, see: https://github.com/epoch8/uv-workspace-codegen/blob/master/README.md +# Do not edit this file manually - changes will be overwritten + +name: Publish jims-widget + +on: + workflow_dispatch: + push: + tags: + - 'jims-*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + + - name: Build wheel + run: uv build + working-directory: libs/jims-widget + + - name: Store the distribution packages + uses: actions/upload-artifact@v6 + with: + name: python-package-distributions + path: dist/ + + publish-to-test-pypi: + environment: + name: testpypi + url: https://test.pypi.org/project/jims-widget/ + permissions: + id-token: write + runs-on: ubuntu-latest + needs: build + + steps: + - uses: actions/download-artifact@v7 + with: + name: python-package-distributions + path: dist/ + + - name: Publish distribution to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + publish-to-pypi: + environment: + name: pypi + url: https://pypi.org/project/jims-widget/ + permissions: + id-token: write + runs-on: ubuntu-latest + needs: + - build + - publish-to-test-pypi + + steps: + - uses: actions/download-artifact@v7 + with: + name: python-package-distributions + path: dist/ + + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/Makefile b/Makefile index 14013ae2..1e38acee 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,9 @@ build_jims_telegram: build_jims_tui: uv build libs/jims-tui + +build_jims_widget: + uv build libs/jims-widget build_vedana_core: uv build libs/vedana-core @@ -23,7 +26,7 @@ build_vedana_etl: build_vedana_backoffice: uv build libs/vedana-backoffice -build: build_jims_backoffice build_jims_core build_jims_api build_jims_telegram build_jims_tui build_vedana_core build_vedana_etl build_vedana_backoffice +build: build_jims_backoffice build_jims_core build_jims_api build_jims_telegram build_jims_tui build_jims_widget build_vedana_core build_vedana_etl build_vedana_backoffice build-vedana-project: cd apps/vedana && make build diff --git a/apps/vedana/docker-compose.yml b/apps/vedana/docker-compose.yml index 94fdcc89..ee9c176e 100644 --- a/apps/vedana/docker-compose.yml +++ b/apps/vedana/docker-compose.yml @@ -57,6 +57,19 @@ services: db: condition: service_healthy + widget: + <<: *app-common + ports: + - "8090:8090" + command: uv run python -m jims_widget.main --app vedana_core.app:app --host 0.0.0.0 --port 8090 + depends_on: + db-migrate: + condition: service_completed_successfully + memgraph: + condition: service_started + db: + condition: service_healthy + memgraph: image: memgraph/memgraph-mage ports: diff --git a/apps/vedana/pyproject.toml b/apps/vedana/pyproject.toml index 04a76454..199ad368 100644 --- a/apps/vedana/pyproject.toml +++ b/apps/vedana/pyproject.toml @@ -10,6 +10,7 @@ dependencies = [ "google-cloud-iam >= 2.19.1", "jims-core>=0.5.1", "jims-api>=0.5.1", + "jims-widget>=0.5.1", "vedana-backoffice", "vedana-etl", "jims-tui", diff --git a/libs/jims-widget/README.md b/libs/jims-widget/README.md new file mode 100644 index 00000000..6a95f1dd --- /dev/null +++ b/libs/jims-widget/README.md @@ -0,0 +1,45 @@ +# JIMS DeepChat Widget + +[DeepChat](https://deepchat.dev/)-based embeddable chat widget for JimsApp backends. + +## Quick start + +**1. Run the widget server** (point it at your JimsApp): + +```bash +uv run jims-widget --app my_app:app --port 8090 --cors-origins "*" +``` + +**2. Embed on any page** — add one script tag: + +```html + +``` + +Optional attributes on the ` + + diff --git a/libs/jims-widget/src/jims_widget/static/jims-widget.js b/libs/jims-widget/src/jims_widget/static/jims-widget.js new file mode 100644 index 00000000..c951c7d1 --- /dev/null +++ b/libs/jims-widget/src/jims_widget/static/jims-widget.js @@ -0,0 +1,237 @@ +/** + * Vedana Chat Widget — embeddable snippet. + * + * Usage: + * + * + * Attributes (on the