diff --git a/Dockerfile b/Dockerfile index 67fd26456..42798758a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -191,6 +191,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ COPY web web +COPY admin admin COPY api api COPY conf conf COPY deepdoc deepdoc diff --git a/admin/admin_client.py b/admin/admin_client.py index 399d173ab..dc368eb5e 100644 --- a/admin/admin_client.py +++ b/admin/admin_client.py @@ -267,10 +267,25 @@ class AdminCLI: columns = list(data[0].keys()) col_widths = {} + def get_string_width(text): + half_width_chars = ( + " !\"#$%&'()*+,-./0123456789:;<=>?@" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" + "abcdefghijklmnopqrstuvwxyz{|}~" + "\t\n\r" + ) + width = 0 + for char in text: + if char in half_width_chars: + width += 1 + else: + width += 2 + return width + for col in columns: - max_width = len(str(col)) + max_width = get_string_width(str(col)) for item in data: - value_len = len(str(item.get(col, ''))) + value_len = get_string_width(str(item.get(col, ''))) if value_len > max_width: max_width = value_len col_widths[col] = max(2, max_width) diff --git a/docker/.env b/docker/.env index 1375f5564..63c12a465 100644 --- a/docker/.env +++ b/docker/.env @@ -91,6 +91,7 @@ REDIS_PASSWORD=infini_rag_flow # The port used to expose RAGFlow's HTTP API service to the host machine, # allowing EXTERNAL access to the service running inside the Docker container. SVR_HTTP_PORT=9380 +ADMIN_SVR_HTTP_PORT=9381 # The RAGFlow Docker image to download. # Defaults to the v0.20.5-slim edition, which is the RAGFlow Docker image without embedding models. diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3583afdf3..960f8506a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -22,9 +22,14 @@ services: # - --no-transport-sse-enabled # Disable legacy SSE endpoints (/sse and /messages/) # - --no-transport-streamable-http-enabled # Disable Streamable HTTP transport (/mcp endpoint) # - --no-json-response # Disable JSON response mode in Streamable HTTP transport (instead of SSE over HTTP) + + # Example configration to start Admin server: + # command: + # - --enable-adminserver container_name: ragflow-server ports: - ${SVR_HTTP_PORT}:9380 + - ${ADMIN_SVR_HTTP_PORT}:9381 - 80:80 - 443:443 - 5678:5678 diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 7570b73dd..5965acfef 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -11,6 +11,7 @@ function usage() { echo " --disable-webserver Disables the web server (nginx + ragflow_server)." echo " --disable-taskexecutor Disables task executor workers." echo " --enable-mcpserver Enables the MCP server." + echo " --enable-adminserver Enables the Admin server." echo " --consumer-no-beg= Start range for consumers (if using range-based)." echo " --consumer-no-end= End range for consumers (if using range-based)." echo " --workers= Number of task executors to run (if range is not used)." @@ -21,12 +22,14 @@ function usage() { echo " $0 --disable-webserver --consumer-no-beg=0 --consumer-no-end=5" echo " $0 --disable-webserver --workers=2 --host-id=myhost123" echo " $0 --enable-mcpserver" + echo " $0 --enable-adminserver" exit 1 } ENABLE_WEBSERVER=1 # Default to enable web server ENABLE_TASKEXECUTOR=1 # Default to enable task executor ENABLE_MCP_SERVER=0 +ENABLE_ADMIN_SERVER=0 # Default close admin server CONSUMER_NO_BEG=0 CONSUMER_NO_END=0 WORKERS=1 @@ -70,6 +73,10 @@ for arg in "$@"; do ENABLE_MCP_SERVER=1 shift ;; + --enable-adminserver) + ENABLE_ADMIN_SERVER=1 + shift + ;; --mcp-host=*) MCP_HOST="${arg#*=}" shift @@ -185,6 +192,12 @@ if [[ "${ENABLE_WEBSERVER}" -eq 1 ]]; then done & fi +if [[ "${ENABLE_ADMIN_SERVER}" -eq 1 ]]; then + echo "Starting admin_server..." + while true; do + "$PY" admin/admin_server.py + done & +fi if [[ "${ENABLE_MCP_SERVER}" -eq 1 ]]; then start_mcp_server diff --git a/docs/guides/manage_users_and_services.md b/docs/guides/manage_users_and_services.md index c032f3c7d..c076904f8 100644 --- a/docs/guides/manage_users_and_services.md +++ b/docs/guides/manage_users_and_services.md @@ -1,3 +1,9 @@ +--- +sidebar_position: 6 +slug: /manage_users_and_services +--- + + # Admin CLI and Admin Service @@ -50,7 +56,7 @@ Commands are case-insensitive and must be terminated with a semicolon(;). `SHOW SERVICE ;` -- Shows detailed status information for the service identified by . +- Shows detailed status information for the service identified by **id**. - [Example](#example-show-service) ### User Management Commands