Use RAGFlow CLI to replace RAGFlow Admin CLI (#12653)

### What problem does this PR solve?

```
$ python admin/client/ragflow_cli.py -t user -u aaa@aaa.com -p 9380

ragflow> list datasets;
ragflow> list default models;
ragflow> show version;

```


### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-01-17 17:52:38 +08:00
committed by GitHub
parent 067ddcbf23
commit 38f0a92da9
7 changed files with 563 additions and 311 deletions

5
.gitignore vendored
View File

@ -203,3 +203,8 @@ backup
.hypothesis .hypothesis
# Added by cargo
/target

View File

@ -21,7 +21,7 @@ cp pyproject.toml release/$PROJECT_NAME/pyproject.toml
cp README.md release/$PROJECT_NAME/README.md cp README.md release/$PROJECT_NAME/README.md
mkdir release/$PROJECT_NAME/$SOURCE_DIR/$PACKAGE_DIR -p mkdir release/$PROJECT_NAME/$SOURCE_DIR/$PACKAGE_DIR -p
cp admin_client.py release/$PROJECT_NAME/$SOURCE_DIR/$PACKAGE_DIR/admin_client.py cp ragflow_cli.py release/$PROJECT_NAME/$SOURCE_DIR/$PACKAGE_DIR/ragflow_cli.py
if [ -d "release/$PROJECT_NAME/$SOURCE_DIR" ]; then if [ -d "release/$PROJECT_NAME/$SOURCE_DIR" ]; then
echo "✅ source dir: release/$PROJECT_NAME/$SOURCE_DIR" echo "✅ source dir: release/$PROJECT_NAME/$SOURCE_DIR"

View File

@ -21,4 +21,4 @@ test = [
] ]
[project.scripts] [project.scripts]
ragflow-cli = "admin_client:main" ragflow-cli = "ragflow_cli:main"

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ from common.file_utils import get_project_base_directory
def crypt(line): def crypt(line):
""" """
decrypt(crypt(input_string)) == base64(input_string), which frontend and admin_client use. decrypt(crypt(input_string)) == base64(input_string), which frontend and ragflow_cli use.
""" """
file_path = os.path.join(get_project_base_directory(), "conf", "public.pem") file_path = os.path.join(get_project_base_directory(), "conf", "public.pem")
rsa_key = RSA.importKey(open(file_path).read(), "Welcome") rsa_key = RSA.importKey(open(file_path).read(), "Welcome")

View File

@ -5,11 +5,11 @@ sidebar_custom_props: {
categoryIcon: LucideSquareTerminal categoryIcon: LucideSquareTerminal
} }
--- ---
# Admin CLI # RAGFlow CLI
The RAGFlow Admin CLI is a command-line-based system administration tool that offers administrators an efficient and flexible method for system interaction and control. Operating on a client-server architecture, it communicates in real-time with the Admin Service, receiving administrator commands and dynamically returning execution results. The RAGFlow CLI is a command-line-based system administration tool that offers administrators an efficient and flexible method for system interaction and control. Operating on a client-server architecture, it communicates in real-time with the Admin Service, receiving administrator commands and dynamically returning execution results.
## Using the Admin CLI ## Using the RAGFlow CLI
1. Ensure the Admin Service is running. 1. Ensure the Admin Service is running.
@ -169,7 +169,7 @@ Commands are case-insensitive and must be terminated with a semicolon(;).
- List all available services. - List all available services.
``` ```
admin> list services; ragflow> list services;
command: list services; command: list services;
Listing all services Listing all services
+-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+ +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+---------+
@ -190,7 +190,7 @@ Listing all services
- Show ragflow_server. - Show ragflow_server.
``` ```
admin> show service 0; ragflow> show service 0;
command: show service 0; command: show service 0;
Showing service: 0 Showing service: 0
Service ragflow_0 is alive. Detail: Service ragflow_0 is alive. Detail:
@ -200,7 +200,7 @@ Confirm elapsed: 26.0 ms.
- Show mysql. - Show mysql.
``` ```
admin> show service 1; ragflow> show service 1;
command: show service 1; command: show service 1;
Showing service: 1 Showing service: 1
Service mysql is alive. Detail: Service mysql is alive. Detail:
@ -216,7 +216,7 @@ Service mysql is alive. Detail:
- Show minio. - Show minio.
``` ```
admin> show service 2; ragflow> show service 2;
command: show service 2; command: show service 2;
Showing service: 2 Showing service: 2
Service minio is alive. Detail: Service minio is alive. Detail:
@ -226,7 +226,7 @@ Confirm elapsed: 2.1 ms.
- Show elasticsearch. - Show elasticsearch.
``` ```
admin> show service 3; ragflow> show service 3;
command: show service 3; command: show service 3;
Showing service: 3 Showing service: 3
Service elasticsearch is alive. Detail: Service elasticsearch is alive. Detail:
@ -240,7 +240,7 @@ Service elasticsearch is alive. Detail:
- Show infinity. - Show infinity.
``` ```
admin> show service 4; ragflow> show service 4;
command: show service 4; command: show service 4;
Showing service: 4 Showing service: 4
Fail to show service, code: 500, message: Infinity is not in use. Fail to show service, code: 500, message: Infinity is not in use.
@ -249,7 +249,7 @@ Fail to show service, code: 500, message: Infinity is not in use.
- Show redis. - Show redis.
``` ```
admin> show service 5; ragflow> show service 5;
command: show service 5; command: show service 5;
Showing service: 5 Showing service: 5
Service redis is alive. Detail: Service redis is alive. Detail:
@ -264,7 +264,7 @@ Service redis is alive. Detail:
- Show RAGFlow version - Show RAGFlow version
``` ```
admin> show version; ragflow> show version;
+-----------------------+ +-----------------------+
| version | | version |
+-----------------------+ +-----------------------+
@ -277,7 +277,7 @@ admin> show version;
- List all user. - List all user.
``` ```
admin> list users; ragflow> list users;
command: list users; command: list users;
Listing all users Listing all users
+-------------------------------+----------------------+-----------+----------+ +-------------------------------+----------------------+-----------+----------+
@ -293,7 +293,7 @@ Listing all users
- Show specified user. - Show specified user.
``` ```
admin> show user "admin@ragflow.io"; ragflow> show user "admin@ragflow.io";
command: show user "admin@ragflow.io"; command: show user "admin@ragflow.io";
Showing user: admin@ragflow.io Showing user: admin@ragflow.io
+-------------------------------+------------------+-----------+--------------+------------------+--------------+----------+-----------------+---------------+--------+-------------------------------+ +-------------------------------+------------------+-----------+--------------+------------------+--------------+----------+-----------------+---------------+--------+-------------------------------+
@ -308,7 +308,7 @@ Showing user: admin@ragflow.io
- Create new user. - Create new user.
``` ```
admin> create user "example@ragflow.io" "psw"; ragflow> create user "example@ragflow.io" "psw";
command: create user "example@ragflow.io" "psw"; command: create user "example@ragflow.io" "psw";
Create user: example@ragflow.io, password: psw, role: user Create user: example@ragflow.io, password: psw, role: user
+----------------------------------+--------------------+----------------------------------+--------------+---------------+----------+ +----------------------------------+--------------------+----------------------------------+--------------+---------------+----------+
@ -323,7 +323,7 @@ Create user: example@ragflow.io, password: psw, role: user
- Alter user password. - Alter user password.
``` ```
admin> alter user password "example@ragflow.io" "newpsw"; ragflow> alter user password "example@ragflow.io" "newpsw";
command: alter user password "example@ragflow.io" "newpsw"; command: alter user password "example@ragflow.io" "newpsw";
Alter user: example@ragflow.io, password: newpsw Alter user: example@ragflow.io, password: newpsw
Password updated successfully! Password updated successfully!
@ -334,7 +334,7 @@ Password updated successfully!
- Alter user active, turn off. - Alter user active, turn off.
``` ```
admin> alter user active "example@ragflow.io" off; ragflow> alter user active "example@ragflow.io" off;
command: alter user active "example@ragflow.io" off; command: alter user active "example@ragflow.io" off;
Alter user example@ragflow.io activate status, turn off. Alter user example@ragflow.io activate status, turn off.
Turn off user activate status successfully! Turn off user activate status successfully!
@ -345,7 +345,7 @@ Turn off user activate status successfully!
- Drop user. - Drop user.
``` ```
admin> Drop user "example@ragflow.io"; ragflow> Drop user "example@ragflow.io";
command: Drop user "example@ragflow.io"; command: Drop user "example@ragflow.io";
Drop user: example@ragflow.io Drop user: example@ragflow.io
Successfully deleted user. Details: Successfully deleted user. Details:
@ -403,7 +403,7 @@ API key deleted successfully
- List the specified user's dataset. - List the specified user's dataset.
``` ```
admin> list datasets of "lynn_inf@hotmail.com"; ragflow> list datasets of "lynn_inf@hotmail.com";
command: list datasets of "lynn_inf@hotmail.com"; command: list datasets of "lynn_inf@hotmail.com";
Listing all datasets of user: lynn_inf@hotmail.com Listing all datasets of user: lynn_inf@hotmail.com
+-----------+-------------------------------+---------+----------+---------------+------------+--------+-----------+-------------------------------+ +-----------+-------------------------------+---------+----------+---------------+------------+--------+-----------+-------------------------------+
@ -419,7 +419,7 @@ Listing all datasets of user: lynn_inf@hotmail.com
- List the specified user's agents. - List the specified user's agents.
``` ```
admin> list agents of "lynn_inf@hotmail.com"; ragflow> list agents of "lynn_inf@hotmail.com";
command: list agents of "lynn_inf@hotmail.com"; command: list agents of "lynn_inf@hotmail.com";
Listing all agents of user: lynn_inf@hotmail.com Listing all agents of user: lynn_inf@hotmail.com
+-----------------+-------------+------------+-----------------+ +-----------------+-------------+------------+-----------------+
@ -434,7 +434,7 @@ Listing all agents of user: lynn_inf@hotmail.com
- Display the current RAGFlow version. - Display the current RAGFlow version.
``` ```
admin> show version; ragflow> show version;
show_version show_version
+-----------------------+ +-----------------------+
| version | | version |
@ -448,7 +448,7 @@ show_version
- Grant administrator privileges to the specified user. - Grant administrator privileges to the specified user.
``` ```
admin> grant admin "anakin.skywalker@ragflow.io"; ragflow> grant admin "anakin.skywalker@ragflow.io";
Grant successfully! Grant successfully!
``` ```
@ -457,7 +457,7 @@ Grant successfully!
- Revoke administrator privileges from the specified user. - Revoke administrator privileges from the specified user.
``` ```
admin> revoke admin "anakin.skywalker@ragflow.io"; ragflow> revoke admin "anakin.skywalker@ragflow.io";
Revoke successfully! Revoke successfully!
``` ```
@ -466,7 +466,7 @@ Revoke successfully!
- List all system settings. - List all system settings.
``` ```
admin> list vars; ragflow> list vars;
+-----------+---------------------+--------------+-----------+ +-----------+---------------------+--------------+-----------+
| data_type | name | source | value | | data_type | name | source | value |
+-----------+---------------------+--------------+-----------+ +-----------+---------------------+--------------+-----------+
@ -488,7 +488,7 @@ admin> list vars;
- Display the content of a specific system configuration/setting by its name or name prefix. - Display the content of a specific system configuration/setting by its name or name prefix.
``` ```
admin> show var mail.server; ragflow> show var mail.server;
+-----------+-------------+--------------+-----------+ +-----------+-------------+--------------+-----------+
| data_type | name | source | value | | data_type | name | source | value |
+-----------+-------------+--------------+-----------+ +-----------+-------------+--------------+-----------+
@ -501,7 +501,7 @@ admin> show var mail.server;
- Set the value for a specified configuration item. - Set the value for a specified configuration item.
``` ```
admin> set var mail.server 127.0.0.1; ragflow> set var mail.server 127.0.0.1;
Set variable successfully Set variable successfully
``` ```
@ -511,7 +511,7 @@ Set variable successfully
- List all system configurations. - List all system configurations.
``` ```
admin> list configs; ragflow> list configs;
+-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+
| extra | host | id | name | port | service_type | | extra | host | id | name | port | service_type |
+-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+ +-------------------------------------------------------------------------------------------+-----------+----+---------------+-------+----------------+
@ -530,7 +530,7 @@ admin> list configs;
- List all system environments which can accessed by Admin service. - List all system environments which can accessed by Admin service.
``` ```
admin> list envs; ragflow> list envs;
+-------------------------+------------------+ +-------------------------+------------------+
| env | value | | env | value |
+-------------------------+------------------+ +-------------------------+------------------+
@ -548,7 +548,7 @@ admin> list envs;
- Show help information. - Show help information.
``` ```
admin> \help ragflow> \help
command: \help command: \help
Commands: Commands:
@ -589,7 +589,7 @@ Meta Commands:
- Exit - Exit
``` ```
admin> \q ragflow> \q
command: \q command: \q
Goodbye! Goodbye!
``` ```

View File

@ -32,6 +32,7 @@ import {
initialLoopValues, initialLoopValues,
initialMessageValues, initialMessageValues,
initialNoteValues, initialNoteValues,
initialPDFGeneratorValues,
initialParserValues, initialParserValues,
initialPubMedValues, initialPubMedValues,
initialRetrievalValues, initialRetrievalValues,
@ -48,7 +49,6 @@ import {
initialVariableAssignerValues, initialVariableAssignerValues,
initialWaitingDialogueValues, initialWaitingDialogueValues,
initialWenCaiValues, initialWenCaiValues,
initialPDFGeneratorValues,
initialWikipediaValues, initialWikipediaValues,
initialYahooFinanceValues, initialYahooFinanceValues,
} from '../constant'; } from '../constant';