diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05ea87fa6..06b6b386d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,3 +120,17 @@ jobs: packages-dir: sdk/python/dist/ password: ${{ secrets.PYPI_API_TOKEN }} verbose: true + + - name: Build ragflow-cli + if: startsWith(github.ref, 'refs/tags/v') + run: | + cd admin/client && \ + uv build + + - name: Publish client package distributions to PyPI + if: startsWith(github.ref, 'refs/tags/v') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: admin/client/dist/ + password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true diff --git a/.gitignore b/.gitignore index 16bd4e7ff..fbf80b3aa 100644 --- a/.gitignore +++ b/.gitignore @@ -149,8 +149,7 @@ out # Nuxt.js build / generate output .nuxt dist -admin/release - +ragflow_cli.egg-info # Gatsby files .cache/ # Comment in the public line in if your project uses Gatsby and not Next.js diff --git a/admin/README.md b/admin/client/README.md similarity index 99% rename from admin/README.md rename to admin/client/README.md index 1200e8123..c8ff2e68d 100644 --- a/admin/README.md +++ b/admin/client/README.md @@ -26,7 +26,7 @@ It consists of a server-side Service and a command-line client (CLI), both imple 2. Launch from source code: ```bash - python admin/admin_server.py + python admin/server/admin_server.py ``` The service will start and listen for incoming connections from the CLI on the configured port. diff --git a/admin/admin_client.py b/admin/client/admin_client.py similarity index 100% rename from admin/admin_client.py rename to admin/client/admin_client.py diff --git a/admin/client/pyproject.toml b/admin/client/pyproject.toml new file mode 100644 index 000000000..120327afa --- /dev/null +++ b/admin/client/pyproject.toml @@ -0,0 +1,24 @@ +[project] +name = "ragflow-cli" +version = "0.21.0.dev5" +description = "Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring. " +authors = [{ name = "Lynn", email = "lynn_inf@hotmail.com" }] +license = { text = "Apache License, Version 2.0" } +readme = "README.md" +requires-python = ">=3.10,<3.13" +dependencies = [ + "requests>=2.30.0,<3.0.0", + "beartype>=0.18.5,<0.19.0", + "pycryptodomex>=3.10.0", + "lark>=1.1.0", +] + +[dependency-groups] +test = [ + "pytest>=8.3.5", + "requests>=2.32.3", + "requests-toolbelt>=1.0.0", +] + +[project.scripts] +ragflow-cli = "admin_client:main" diff --git a/admin/admin_server.py b/admin/server/admin_server.py similarity index 100% rename from admin/admin_server.py rename to admin/server/admin_server.py diff --git a/admin/auth.py b/admin/server/auth.py similarity index 100% rename from admin/auth.py rename to admin/server/auth.py diff --git a/admin/config.py b/admin/server/config.py similarity index 100% rename from admin/config.py rename to admin/server/config.py diff --git a/admin/exceptions.py b/admin/server/exceptions.py similarity index 100% rename from admin/exceptions.py rename to admin/server/exceptions.py diff --git a/admin/models.py b/admin/server/models.py similarity index 100% rename from admin/models.py rename to admin/server/models.py diff --git a/admin/responses.py b/admin/server/responses.py similarity index 100% rename from admin/responses.py rename to admin/server/responses.py diff --git a/admin/routes.py b/admin/server/routes.py similarity index 99% rename from admin/routes.py rename to admin/server/routes.py index afc82bc9d..3bcb01244 100644 --- a/admin/routes.py +++ b/admin/server/routes.py @@ -17,7 +17,7 @@ from flask import Blueprint, request -from auth import login_verify +from admin.server.auth import login_verify from responses import success_response, error_response from services import UserMgr, ServiceMgr, UserServiceMgr from api.common.exceptions import AdminException diff --git a/admin/services.py b/admin/server/services.py similarity index 99% rename from admin/services.py rename to admin/server/services.py index dd1a3c12b..c7dd30ab7 100644 --- a/admin/services.py +++ b/admin/server/services.py @@ -27,7 +27,7 @@ from api.utils.crypt import decrypt from api.utils import health_utils from api.common.exceptions import AdminException, UserAlreadyExistsError, UserNotFoundError -from config import SERVICE_CONFIGS +from admin.server.config import SERVICE_CONFIGS class UserMgr: diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 5965acfef..7f660d06d 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -195,7 +195,7 @@ fi if [[ "${ENABLE_ADMIN_SERVER}" -eq 1 ]]; then echo "Starting admin_server..." while true; do - "$PY" admin/admin_server.py + "$PY" admin/server/admin_server.py done & fi diff --git a/docs/guides/manage_users_and_services.md b/docs/guides/manage_users_and_services.md index faafbf198..2fb090fa4 100644 --- a/docs/guides/manage_users_and_services.md +++ b/docs/guides/manage_users_and_services.md @@ -12,21 +12,21 @@ The Admin CLI and Admin Service form a client-server architectural suite for RAG -### Starting the Admin Service +## Starting the Admin Service -#### Launching from source code +### Launching from source code 1. Before start Admin Service, please make sure RAGFlow system is already started. 2. Launch from source code: ```bash - python admin/admin_server.py + python admin/server/admin_server.py ``` The service will start and listen for incoming connections from the CLI on the configured port. -#### Using docker image +### Using docker image 1. Before startup, please configure the `docker_compose.yml` file to enable admin server: @@ -39,7 +39,7 @@ The Admin CLI and Admin Service form a client-server architectural suite for RAG -### Using the Admin CLI +## Using the Admin CLI 1. Ensure the Admin Service is running. @@ -55,7 +55,7 @@ The Admin CLI and Admin Service form a client-server architectural suite for RAG ragflow-cli -h 0.0.0.0 -p 9381 ``` -​ Enter superuser's password to login. Default password is `admin`. + Enter superuser's password to login. Default password is `admin`.