Add license and fingerprint API hook (#13548)

### What problem does this PR solve?

For EE

### 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-03-12 11:52:39 +08:00
committed by GitHub
parent 2fb1360d9d
commit 90afce192c
4 changed files with 93 additions and 0 deletions

View File

@@ -583,6 +583,37 @@ class RAGFlowClient:
else:
print(f"Fail to list variables, code: {res_json['code']}, message: {res_json['message']}")
def show_fingerprint(self, command):
if self.server_type != "admin":
print("This command is only allowed in ADMIN mode")
response = self.http_client.request("GET", "/admin/fingerprint", use_api_base=True, auth_kind="admin")
res_json = response.json()
if response.status_code == 200:
self._print_table_simple(res_json["data"])
else:
print(f"Fail to show fingerprint, code: {res_json['code']}, message: {res_json['message']}")
def set_license(self, command):
if self.server_type != "admin":
print("This command is only allowed in ADMIN mode")
license = command["license"]
response = self.http_client.request("POST", "/admin/license", json_body={"license": license}, use_api_base=True, auth_kind="admin")
res_json = response.json()
if response.status_code == 200:
print("Set license successfully")
else:
print(f"Fail to set license, code: {res_json['code']}, message: {res_json['message']}")
def show_license(self, command):
if self.server_type != "admin":
print("This command is only allowed in ADMIN mode")
response = self.http_client.request("GET", "/admin/license", use_api_base=True, auth_kind="admin")
res_json = response.json()
if response.status_code == 200:
self._print_table_simple(res_json["data"])
else:
print(f"Fail to show license, code: {res_json['code']}, message: {res_json['message']}")
def list_server_configs(self, command):
"""List server configs by calling /system/configs API and flattening the JSON response."""
response = self.http_client.request("GET", "/system/configs", use_api_base=False, auth_kind="web")
@@ -1514,6 +1545,12 @@ def run_command(client: RAGFlowClient, command_dict: dict):
client.list_configs(command_dict)
case "list_environments":
client.list_environments(command_dict)
case "show_fingerprint":
client.show_fingerprint(command_dict)
case "set_license":
client.set_license(command_dict)
case "show_license":
client.show_license(command_dict)
case "list_server_configs":
client.list_server_configs(command_dict)
case "create_model_provider":