ragflow-cli 0.25.0.dev5__tar.gz → 0.25.0.dev6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/PKG-INFO +1 -1
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/parser.py +34 -1
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/pyproject.toml +1 -1
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_cli.egg-info/PKG-INFO +1 -1
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_client.py +74 -10
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/README.md +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/http_client.py +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_cli.egg-info/SOURCES.txt +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_cli.egg-info/dependency_links.txt +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_cli.egg-info/entry_points.txt +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_cli.egg-info/requires.txt +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_cli.egg-info/top_level.txt +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_cli.py +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/setup.cfg +0 -0
- {ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/user.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ragflow-cli
|
|
3
|
-
Version: 0.25.0.
|
|
3
|
+
Version: 0.25.0.dev6
|
|
4
4
|
Summary: Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring.
|
|
5
5
|
Author-email: Lynn <lynn_inf@hotmail.com>
|
|
6
6
|
License: Apache License, Version 2.0
|
|
@@ -93,6 +93,11 @@ sql_command: login_user
|
|
|
93
93
|
| list_chat_sessions
|
|
94
94
|
| chat_on_session
|
|
95
95
|
| list_server_configs
|
|
96
|
+
| show_fingerprint
|
|
97
|
+
| set_license
|
|
98
|
+
| set_license_config
|
|
99
|
+
| show_license
|
|
100
|
+
| check_license
|
|
96
101
|
| benchmark
|
|
97
102
|
|
|
98
103
|
// meta command definition
|
|
@@ -178,6 +183,10 @@ PING: "PING"i
|
|
|
178
183
|
SESSION: "SESSION"i
|
|
179
184
|
SESSIONS: "SESSIONS"i
|
|
180
185
|
SERVER: "SERVER"i
|
|
186
|
+
FINGERPRINT: "FINGERPRINT"i
|
|
187
|
+
LICENSE: "LICENSE"i
|
|
188
|
+
CHECK: "CHECK"i
|
|
189
|
+
CONFIG: "CONFIG"i
|
|
181
190
|
|
|
182
191
|
login_user: LOGIN USER quoted_string ";"
|
|
183
192
|
list_services: LIST SERVICES ";"
|
|
@@ -223,6 +232,12 @@ list_variables: LIST VARS ";"
|
|
|
223
232
|
list_configs: LIST CONFIGS ";"
|
|
224
233
|
list_environments: LIST ENVS ";"
|
|
225
234
|
|
|
235
|
+
show_fingerprint: SHOW FINGERPRINT ";"
|
|
236
|
+
set_license: SET LICENSE quoted_string ";"
|
|
237
|
+
set_license_config: SET LICENSE CONFIG NUMBER NUMBER ";"
|
|
238
|
+
show_license: SHOW LICENSE ";"
|
|
239
|
+
check_license: CHECK LICENSE ";"
|
|
240
|
+
|
|
226
241
|
list_server_configs: LIST SERVER CONFIGS ";"
|
|
227
242
|
|
|
228
243
|
benchmark: BENCHMARK NUMBER NUMBER user_statement
|
|
@@ -305,7 +320,7 @@ identifier_list: identifier ("," identifier)*
|
|
|
305
320
|
|
|
306
321
|
identifier: WORD
|
|
307
322
|
quoted_string: QUOTED_STRING
|
|
308
|
-
status: WORD
|
|
323
|
+
status: ON | WORD
|
|
309
324
|
|
|
310
325
|
QUOTED_STRING: /'[^']+'/ | /"[^"]+"/
|
|
311
326
|
WORD: /[a-zA-Z0-9_\-\.]+/
|
|
@@ -477,6 +492,24 @@ class RAGFlowCLITransformer(Transformer):
|
|
|
477
492
|
def list_environments(self, items):
|
|
478
493
|
return {"type": "list_environments"}
|
|
479
494
|
|
|
495
|
+
def show_fingerprint(self, items):
|
|
496
|
+
return {"type": "show_fingerprint"}
|
|
497
|
+
|
|
498
|
+
def set_license(self, items):
|
|
499
|
+
license = items[2].children[0].strip("'\"")
|
|
500
|
+
return {"type": "set_license", "license": license}
|
|
501
|
+
|
|
502
|
+
def set_license_config(self, items):
|
|
503
|
+
value1: int = int(items[3])
|
|
504
|
+
value2: int = int(items[4])
|
|
505
|
+
return {"type": "set_license_config", "value1": value1, "value2": value2}
|
|
506
|
+
|
|
507
|
+
def show_license(self, items):
|
|
508
|
+
return {"type": "show_license"}
|
|
509
|
+
|
|
510
|
+
def check_license(self, items):
|
|
511
|
+
return {"type": "check_license"}
|
|
512
|
+
|
|
480
513
|
def list_server_configs(self, items):
|
|
481
514
|
return {"type": "list_server_configs"}
|
|
482
515
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ragflow-cli"
|
|
3
|
-
version = "0.25.0.
|
|
3
|
+
version = "0.25.0.dev6"
|
|
4
4
|
description = "Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring. "
|
|
5
5
|
authors = [{ name = "Lynn", email = "lynn_inf@hotmail.com" }]
|
|
6
6
|
license = { text = "Apache License, Version 2.0" }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ragflow-cli
|
|
3
|
-
Version: 0.25.0.
|
|
3
|
+
Version: 0.25.0.dev6
|
|
4
4
|
Summary: Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring.
|
|
5
5
|
Author-email: Lynn <lynn_inf@hotmail.com>
|
|
6
6
|
License: Apache License, Version 2.0
|
|
@@ -583,6 +583,60 @@ class RAGFlowClient:
|
|
|
583
583
|
else:
|
|
584
584
|
print(f"Fail to list variables, code: {res_json['code']}, message: {res_json['message']}")
|
|
585
585
|
|
|
586
|
+
def show_fingerprint(self, command):
|
|
587
|
+
if self.server_type != "admin":
|
|
588
|
+
print("This command is only allowed in ADMIN mode")
|
|
589
|
+
response = self.http_client.request("GET", "/admin/fingerprint", use_api_base=True, auth_kind="admin")
|
|
590
|
+
res_json = response.json()
|
|
591
|
+
if response.status_code == 200:
|
|
592
|
+
self._print_table_simple(res_json["data"])
|
|
593
|
+
else:
|
|
594
|
+
print(f"Fail to show fingerprint, code: {res_json['code']}, message: {res_json['message']}")
|
|
595
|
+
|
|
596
|
+
def set_license(self, command):
|
|
597
|
+
if self.server_type != "admin":
|
|
598
|
+
print("This command is only allowed in ADMIN mode")
|
|
599
|
+
license = command["license"]
|
|
600
|
+
response = self.http_client.request("POST", "/admin/license", json_body={"license": license}, use_api_base=True, auth_kind="admin")
|
|
601
|
+
res_json = response.json()
|
|
602
|
+
if response.status_code == 200:
|
|
603
|
+
print("Set license successfully")
|
|
604
|
+
else:
|
|
605
|
+
print(f"Fail to set license, code: {res_json['code']}, message: {res_json['message']}")
|
|
606
|
+
|
|
607
|
+
def set_license_config(self, command):
|
|
608
|
+
if self.server_type != "admin":
|
|
609
|
+
print("This command is only allowed in ADMIN mode")
|
|
610
|
+
value1 = command["value1"]
|
|
611
|
+
value2 = command["value2"]
|
|
612
|
+
response = self.http_client.request("POST", "/admin/license/config", json_body={"value1": value1, "value2": value2}, use_api_base=True, auth_kind="admin")
|
|
613
|
+
res_json = response.json()
|
|
614
|
+
if response.status_code == 200:
|
|
615
|
+
print("Set license successfully")
|
|
616
|
+
else:
|
|
617
|
+
print(f"Fail to set license, code: {res_json['code']}, message: {res_json['message']}")
|
|
618
|
+
|
|
619
|
+
def show_license(self, command):
|
|
620
|
+
if self.server_type != "admin":
|
|
621
|
+
print("This command is only allowed in ADMIN mode")
|
|
622
|
+
response = self.http_client.request("GET", "/admin/license", use_api_base=True, auth_kind="admin")
|
|
623
|
+
res_json = response.json()
|
|
624
|
+
if response.status_code == 200:
|
|
625
|
+
self._print_table_simple(res_json["data"])
|
|
626
|
+
else:
|
|
627
|
+
print(f"Fail to show license, code: {res_json['code']}, message: {res_json['message']}")
|
|
628
|
+
|
|
629
|
+
def check_license(self, command):
|
|
630
|
+
if self.server_type != "admin":
|
|
631
|
+
print("This command is only allowed in ADMIN mode")
|
|
632
|
+
response = self.http_client.request("GET", "/admin/license?check=true", use_api_base=True, auth_kind="admin")
|
|
633
|
+
res_json = response.json()
|
|
634
|
+
if response.status_code == 200:
|
|
635
|
+
print(res_json["data"])
|
|
636
|
+
else:
|
|
637
|
+
print(f"Fail to show license, code: {res_json['code']}, message: {res_json['message']}")
|
|
638
|
+
|
|
639
|
+
|
|
586
640
|
def list_server_configs(self, command):
|
|
587
641
|
"""List server configs by calling /system/configs API and flattening the JSON response."""
|
|
588
642
|
response = self.http_client.request("GET", "/system/configs", use_api_base=False, auth_kind="web")
|
|
@@ -710,14 +764,14 @@ class RAGFlowClient:
|
|
|
710
764
|
|
|
711
765
|
iterations = command.get("iterations", 1)
|
|
712
766
|
if iterations > 1:
|
|
713
|
-
response = self.http_client.request("
|
|
767
|
+
response = self.http_client.request("GET", "/datasets", use_api_base=True, auth_kind="web",
|
|
714
768
|
iterations=iterations)
|
|
715
769
|
return response
|
|
716
770
|
else:
|
|
717
|
-
response = self.http_client.request("
|
|
771
|
+
response = self.http_client.request("GET", "/datasets", use_api_base=True, auth_kind="web")
|
|
718
772
|
res_json = response.json()
|
|
719
773
|
if response.status_code == 200:
|
|
720
|
-
self._print_table_simple(res_json["data"]
|
|
774
|
+
self._print_table_simple(res_json["data"])
|
|
721
775
|
else:
|
|
722
776
|
print(f"Fail to list datasets, code: {res_json['code']}, message: {res_json['message']}")
|
|
723
777
|
return None
|
|
@@ -727,13 +781,13 @@ class RAGFlowClient:
|
|
|
727
781
|
print("This command is only allowed in USER mode")
|
|
728
782
|
payload = {
|
|
729
783
|
"name": command["dataset_name"],
|
|
730
|
-
"
|
|
784
|
+
"embedding_model": command["embedding"]
|
|
731
785
|
}
|
|
732
786
|
if "parser_id" in command:
|
|
733
|
-
payload["
|
|
787
|
+
payload["chunk_method"] = command["parser"]
|
|
734
788
|
if "pipeline" in command:
|
|
735
789
|
payload["pipeline_id"] = command["pipeline"]
|
|
736
|
-
response = self.http_client.request("POST", "/
|
|
790
|
+
response = self.http_client.request("POST", "/datasets", json_body=payload, use_api_base=True,
|
|
737
791
|
auth_kind="web")
|
|
738
792
|
res_json = response.json()
|
|
739
793
|
if response.status_code == 200:
|
|
@@ -749,8 +803,8 @@ class RAGFlowClient:
|
|
|
749
803
|
dataset_id = self._get_dataset_id(dataset_name)
|
|
750
804
|
if dataset_id is None:
|
|
751
805
|
return
|
|
752
|
-
payload = {"
|
|
753
|
-
response = self.http_client.request("
|
|
806
|
+
payload = {"ids": [dataset_id]}
|
|
807
|
+
response = self.http_client.request("DELETE", "/datasets", json_body=payload, use_api_base=True, auth_kind="web")
|
|
754
808
|
res_json = response.json()
|
|
755
809
|
if response.status_code == 200:
|
|
756
810
|
print(f"Drop dataset {dataset_name} successfully")
|
|
@@ -1295,13 +1349,13 @@ class RAGFlowClient:
|
|
|
1295
1349
|
return res_json["data"]["docs"]
|
|
1296
1350
|
|
|
1297
1351
|
def _get_dataset_id(self, dataset_name: str):
|
|
1298
|
-
response = self.http_client.request("
|
|
1352
|
+
response = self.http_client.request("GET", "/datasets", use_api_base=True, auth_kind="web")
|
|
1299
1353
|
res_json = response.json()
|
|
1300
1354
|
if response.status_code != 200:
|
|
1301
1355
|
print(f"Fail to list datasets, code: {res_json['code']}, message: {res_json['message']}")
|
|
1302
1356
|
return None
|
|
1303
1357
|
|
|
1304
|
-
dataset_list = res_json["data"]
|
|
1358
|
+
dataset_list = res_json["data"]
|
|
1305
1359
|
dataset_id: str = ""
|
|
1306
1360
|
for dataset in dataset_list:
|
|
1307
1361
|
if dataset["name"] == dataset_name:
|
|
@@ -1514,6 +1568,16 @@ def run_command(client: RAGFlowClient, command_dict: dict):
|
|
|
1514
1568
|
client.list_configs(command_dict)
|
|
1515
1569
|
case "list_environments":
|
|
1516
1570
|
client.list_environments(command_dict)
|
|
1571
|
+
case "show_fingerprint":
|
|
1572
|
+
client.show_fingerprint(command_dict)
|
|
1573
|
+
case "set_license":
|
|
1574
|
+
client.set_license(command_dict)
|
|
1575
|
+
case "set_license_config":
|
|
1576
|
+
client.set_license_config(command_dict)
|
|
1577
|
+
case "show_license":
|
|
1578
|
+
client.show_license(command_dict)
|
|
1579
|
+
case "check_license":
|
|
1580
|
+
client.check_license(command_dict)
|
|
1517
1581
|
case "list_server_configs":
|
|
1518
1582
|
client.list_server_configs(command_dict)
|
|
1519
1583
|
case "create_model_provider":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ragflow_cli-0.25.0.dev5 → ragflow_cli-0.25.0.dev6}/ragflow_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|