ragflow-cli 0.26.3__tar.gz → 0.27.0__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.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragflow-cli
3
- Version: 0.26.3
3
+ Version: 0.27.0
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
7
7
  Requires-Python: <3.14,>=3.13
8
8
  Description-Content-Type: text/markdown
9
9
  Requires-Dist: requests<3.0.0,>=2.30.0
10
- Requires-Dist: beartype<1.0.0,>=0.20.0
10
+ Requires-Dist: beartype<1.0.0,>=0.22.9
11
11
  Requires-Dist: pycryptodomex>=3.10.0
12
12
  Requires-Dist: lark>=1.1.0
13
13
  Requires-Dist: requests-toolbelt>=1.0.0
@@ -42,7 +42,7 @@ It consists of a server-side Service and a command-line client (CLI), both imple
42
42
  ```bash
43
43
  python admin/server/admin_server.py
44
44
  ```
45
- The service will start and listen for incoming connections from the CLI on the configured port.
45
+ The service will start and listen for incoming connections from the CLI on the configured port.
46
46
 
47
47
  #### Using docker image
48
48
 
@@ -62,7 +62,7 @@ It consists of a server-side Service and a command-line client (CLI), both imple
62
62
  1. Ensure the Admin Service is running.
63
63
  2. Install ragflow-cli.
64
64
  ```bash
65
- pip install ragflow-cli==0.26.3
65
+ pip install ragflow-cli==0.27.0
66
66
  ```
67
67
  3. Launch the CLI client:
68
68
  ```bash
@@ -72,9 +72,9 @@ It consists of a server-side Service and a command-line client (CLI), both imple
72
72
  The default password is admin.
73
73
 
74
74
  **Parameters:**
75
-
75
+
76
76
  - -h: RAGFlow admin server host address
77
-
77
+
78
78
  - -p: RAGFlow admin server port
79
79
 
80
80
 
@@ -28,7 +28,7 @@ It consists of a server-side Service and a command-line client (CLI), both imple
28
28
  ```bash
29
29
  python admin/server/admin_server.py
30
30
  ```
31
- The service will start and listen for incoming connections from the CLI on the configured port.
31
+ The service will start and listen for incoming connections from the CLI on the configured port.
32
32
 
33
33
  #### Using docker image
34
34
 
@@ -48,7 +48,7 @@ It consists of a server-side Service and a command-line client (CLI), both imple
48
48
  1. Ensure the Admin Service is running.
49
49
  2. Install ragflow-cli.
50
50
  ```bash
51
- pip install ragflow-cli==0.26.3
51
+ pip install ragflow-cli==0.27.0
52
52
  ```
53
53
  3. Launch the CLI client:
54
54
  ```bash
@@ -58,9 +58,9 @@ It consists of a server-side Service and a command-line client (CLI), both imple
58
58
  The default password is admin.
59
59
 
60
60
  **Parameters:**
61
-
61
+
62
62
  - -h: RAGFlow admin server host address
63
-
63
+
64
64
  - -p: RAGFlow admin server port
65
65
 
66
66
 
@@ -25,14 +25,14 @@ import requests
25
25
 
26
26
  class HttpClient:
27
27
  def __init__(
28
- self,
29
- host: str = "127.0.0.1",
30
- port: int = 9381,
31
- api_version: str = "v1",
32
- api_key: Optional[str] = None,
33
- connect_timeout: float = 5.0,
34
- read_timeout: float = 60.0,
35
- verify_ssl: bool = False,
28
+ self,
29
+ host: str = "127.0.0.1",
30
+ port: int = 9381,
31
+ api_version: str = "v1",
32
+ api_key: Optional[str] = None,
33
+ connect_timeout: float = 5.0,
34
+ read_timeout: float = 60.0,
35
+ verify_ssl: bool = False,
36
36
  ) -> None:
37
37
  self.host = host
38
38
  self.port = port
@@ -71,19 +71,19 @@ class HttpClient:
71
71
  return headers
72
72
 
73
73
  def request(
74
- self,
75
- method: str,
76
- path: str,
77
- *,
78
- use_api_base: bool = True,
79
- auth_kind: Optional[str] = "api",
80
- headers: Optional[Dict[str, str]] = None,
81
- json_body: Optional[Dict[str, Any]] = None,
82
- data: Any = None,
83
- files: Any = None,
84
- params: Optional[Dict[str, Any]] = None,
85
- stream: bool = False,
86
- iterations: int = 1,
74
+ self,
75
+ method: str,
76
+ path: str,
77
+ *,
78
+ use_api_base: bool = True,
79
+ auth_kind: Optional[str] = "api",
80
+ headers: Optional[Dict[str, str]] = None,
81
+ json_body: Optional[Dict[str, Any]] = None,
82
+ data: Any = None,
83
+ files: Any = None,
84
+ params: Optional[Dict[str, Any]] = None,
85
+ stream: bool = False,
86
+ iterations: int = 1,
87
87
  ) -> requests.Response | dict:
88
88
  url = self.build_url(path, use_api_base=use_api_base)
89
89
  merged_headers = self._headers(auth_kind, headers)
@@ -144,18 +144,18 @@ class HttpClient:
144
144
  # )
145
145
 
146
146
  def request_json(
147
- self,
148
- method: str,
149
- path: str,
150
- *,
151
- use_api_base: bool = True,
152
- auth_kind: Optional[str] = "api",
153
- headers: Optional[Dict[str, str]] = None,
154
- json_body: Optional[Dict[str, Any]] = None,
155
- data: Any = None,
156
- files: Any = None,
157
- params: Optional[Dict[str, Any]] = None,
158
- stream: bool = False,
147
+ self,
148
+ method: str,
149
+ path: str,
150
+ *,
151
+ use_api_base: bool = True,
152
+ auth_kind: Optional[str] = "api",
153
+ headers: Optional[Dict[str, str]] = None,
154
+ json_body: Optional[Dict[str, Any]] = None,
155
+ data: Any = None,
156
+ files: Any = None,
157
+ params: Optional[Dict[str, Any]] = None,
158
+ stream: bool = False,
159
159
  ) -> Dict[str, Any]:
160
160
  response = self.request(
161
161
  method,
@@ -112,6 +112,8 @@ sql_command: login_user
112
112
  | set_license
113
113
  | set_license_config
114
114
  | show_license
115
+ | generate_nav_for_dataset
116
+ | navigation_search
115
117
  | check_license
116
118
  | benchmark
117
119
 
@@ -171,6 +173,9 @@ ENVS: "ENVS"i
171
173
  KEY: "KEY"i
172
174
  KEYS: "KEYS"i
173
175
  GENERATE: "GENERATE"i
176
+ NAVIGATION: "NAVIGATION"i
177
+ MODE: "MODE"i
178
+ TOPK: "TOPK"i
174
179
  MODEL: "MODEL"i
175
180
  MODELS: "MODELS"i
176
181
  PROVIDER: "PROVIDER"i
@@ -194,6 +199,7 @@ SIZE: "SIZE"i
194
199
  PARSER: "PARSER"i
195
200
  PIPELINE: "PIPELINE"i
196
201
  SEARCH: "SEARCH"i
202
+ EXPLORE: "EXPLORE"i
197
203
  CURRENT: "CURRENT"i
198
204
  LLM: "LLM"i
199
205
  VLM: "VLM"i
@@ -336,8 +342,8 @@ reset_default_asr: RESET DEFAULT ASR ";"
336
342
  reset_default_tts: RESET DEFAULT TTS ";"
337
343
 
338
344
  list_user_datasets: LIST DATASETS ";"
339
- create_user_dataset_with_parser: CREATE DATASET quoted_string WITH EMBEDDING quoted_string PARSER quoted_string ";"
340
- create_user_dataset_with_pipeline: CREATE DATASET quoted_string WITH EMBEDDING quoted_string PIPELINE quoted_string ";"
345
+ create_user_dataset_with_parser: CREATE DATASET quoted_string WITH EMBEDDING quoted_string PARSER quoted_string ";"
346
+ create_user_dataset_with_pipeline: CREATE DATASET quoted_string WITH EMBEDDING quoted_string PIPELINE quoted_string ";"
341
347
  drop_user_dataset: DROP DATASET quoted_string ";"
342
348
  list_user_dataset_files: LIST FILES OF DATASET quoted_string ";"
343
349
  list_user_dataset_documents: LIST DOCUMENTS OF DATASET quoted_string ";"
@@ -373,6 +379,8 @@ create_metadata_table: CREATE METADATA TABLE ";"
373
379
  drop_metadata_table: DROP METADATA TABLE ";"
374
380
  insert_dataset_from_file: INSERT DATASET FROM FILE quoted_string ";"
375
381
  insert_metadata_from_file: INSERT METADATA FROM FILE quoted_string ";"
382
+ generate_nav_for_dataset: GENERATE NAVIGATION OF DATASET quoted_string ";"
383
+ navigation_search: NAVIGATION SEARCH quoted_string IN DATASET quoted_string MODE quoted_string (TOPK NUMBER)? ";"
376
384
  update_chunk: UPDATE CHUNK quoted_string OF DATASET quoted_string SET quoted_string ";"
377
385
 
378
386
  identifier_list: identifier (COMMA identifier)*
@@ -640,15 +648,13 @@ class RAGFlowCLITransformer(Transformer):
640
648
  dataset_name = items[2].children[0].strip("'\"")
641
649
  embedding = items[5].children[0].strip("'\"")
642
650
  parser_type = items[7].children[0].strip("'\"")
643
- return {"type": "create_user_dataset", "dataset_name": dataset_name, "embedding": embedding,
644
- "parser_type": parser_type}
651
+ return {"type": "create_user_dataset", "dataset_name": dataset_name, "embedding": embedding, "parser_type": parser_type}
645
652
 
646
653
  def create_user_dataset_with_pipeline(self, items):
647
654
  dataset_name = items[2].children[0].strip("'\"")
648
655
  embedding = items[5].children[0].strip("'\"")
649
656
  pipeline = items[7].children[0].strip("'\"")
650
- return {"type": "create_user_dataset", "dataset_name": dataset_name, "embedding": embedding,
651
- "pipeline": pipeline}
657
+ return {"type": "create_user_dataset", "dataset_name": dataset_name, "embedding": embedding, "pipeline": pipeline}
652
658
 
653
659
  def drop_user_dataset(self, items):
654
660
  dataset_name = items[2].children[0].strip("'\"")
@@ -666,7 +672,7 @@ class RAGFlowCLITransformer(Transformer):
666
672
  dataset_names = []
667
673
  dataset_names.append(items[4].children[0].strip("'\""))
668
674
  for i in range(5, len(items)):
669
- if items[i] and hasattr(items[i], 'children') and items[i].children:
675
+ if items[i] and hasattr(items[i], "children") and items[i].children:
670
676
  dataset_names.append(items[i].children[0].strip("'\""))
671
677
  return {"type": "list_user_datasets_metadata", "dataset_names": dataset_names}
672
678
 
@@ -675,7 +681,7 @@ class RAGFlowCLITransformer(Transformer):
675
681
  doc_ids = []
676
682
  if len(items) > 6 and items[6] == "DOCUMENTS":
677
683
  for i in range(7, len(items)):
678
- if items[i] and hasattr(items[i], 'children') and items[i].children:
684
+ if items[i] and hasattr(items[i], "children") and items[i].children:
679
685
  doc_id = items[i].children[0].strip("'\"")
680
686
  doc_ids.append(doc_id)
681
687
  return {"type": "list_user_documents_metadata_summary", "dataset_name": dataset_name, "document_ids": doc_ids}
@@ -698,17 +704,17 @@ class RAGFlowCLITransformer(Transformer):
698
704
  dataset_name = None
699
705
  vector_size = None
700
706
  for i, item in enumerate(items):
701
- if hasattr(item, 'data') and item.data == 'quoted_string':
707
+ if hasattr(item, "data") and item.data == "quoted_string":
702
708
  dataset_name = item.children[0].strip("'\"")
703
- if hasattr(item, 'type') and item.type == 'NUMBER':
704
- if i > 0 and items[i-1].type == 'SIZE' and items[i-2].type == 'VECTOR':
709
+ if hasattr(item, "type") and item.type == "NUMBER":
710
+ if i > 0 and items[i - 1].type == "SIZE" and items[i - 2].type == "VECTOR":
705
711
  vector_size = int(item)
706
712
  return {"type": "create_dataset_table", "dataset_name": dataset_name, "vector_size": vector_size}
707
713
 
708
714
  def drop_dataset_table(self, items):
709
715
  dataset_name = None
710
716
  for item in items:
711
- if hasattr(item, 'data') and item.data == 'quoted_string':
717
+ if hasattr(item, "data") and item.data == "quoted_string":
712
718
  dataset_name = item.children[0].strip("'\"")
713
719
  return {"type": "drop_dataset_table", "dataset_name": dataset_name}
714
720
 
@@ -790,9 +796,38 @@ class RAGFlowCLITransformer(Transformer):
790
796
  file_path = items[4].children[0].strip("'\"")
791
797
  return {"type": "insert_metadata_from_file", "file_path": file_path}
792
798
 
799
+ def generate_nav_for_dataset(self, items):
800
+ dataset_id = items[4].children[0].strip("'\"")
801
+ return {"type": "generate_nav_for_dataset", "dataset_id": dataset_id}
802
+
803
+ def navigation_search(self, items):
804
+ query = items[2].children[0].strip("'\"")
805
+ dataset_name = items[5].children[0].strip("'\"")
806
+ mode = items[7].children[0].strip("'\"")
807
+ topk = None
808
+ # If TOPK was specified, items will be longer.
809
+ if len(items) > 9:
810
+ try:
811
+ extra = items[8]
812
+ if hasattr(extra, "data"):
813
+ # group wrapper: extra.children = [TOPK, NUMBER]
814
+ topk = int(extra.children[1])
815
+ else:
816
+ # flattened: items[8] = TOPK, items[9] = NUMBER
817
+ topk = int(items[9])
818
+ except (ValueError, IndexError):
819
+ topk = None
820
+ return {
821
+ "type": "navigation_search",
822
+ "query": query,
823
+ "dataset_id": dataset_name,
824
+ "mode": mode,
825
+ "topk": topk,
826
+ }
827
+
793
828
  def update_chunk(self, items):
794
829
  def get_quoted_value(item):
795
- if hasattr(item, 'children') and item.children:
830
+ if hasattr(item, "children") and item.children:
796
831
  return item.children[0].strip("'\"")
797
832
  return str(item).strip("'\"")
798
833
 
@@ -813,16 +848,16 @@ class RAGFlowCLITransformer(Transformer):
813
848
  for i in range(2, len(items)):
814
849
  item = items[i]
815
850
  # Check for FROM token to stop
816
- if hasattr(item, 'type') and item.type == 'FROM':
851
+ if hasattr(item, "type") and item.type == "FROM":
817
852
  break
818
- if hasattr(item, 'children') and item.children:
853
+ if hasattr(item, "children") and item.children:
819
854
  tag = item.children[0].strip("'\"")
820
855
  tags.append(tag)
821
856
  # Find dataset_name: quoted_string after DATASET
822
857
  dataset_name = None
823
858
  for i, item in enumerate(items):
824
859
  # Check if item is a DATASET token
825
- if hasattr(item, 'type') and item.type == 'DATASET':
860
+ if hasattr(item, "type") and item.type == "DATASET":
826
861
  # Next item should be quoted_string
827
862
  dataset_name = items[i + 1].children[0].strip("'\"")
828
863
  break
@@ -835,10 +870,10 @@ class RAGFlowCLITransformer(Transformer):
835
870
 
836
871
  # Check if it's "REMOVE ALL CHUNKS"
837
872
  for item in items:
838
- if hasattr(item, 'type') and item.type == 'ALL':
873
+ if hasattr(item, "type") and item.type == "ALL":
839
874
  # Find doc_id
840
875
  for j, inner_item in enumerate(items):
841
- if hasattr(inner_item, 'type') and inner_item.type == 'DOCUMENT':
876
+ if hasattr(inner_item, "type") and inner_item.type == "DOCUMENT":
842
877
  doc_id = items[j + 1].children[0].strip("'\"")
843
878
  return {"type": "remove_chunks", "doc_id": doc_id, "delete_all": True}
844
879
 
@@ -846,12 +881,12 @@ class RAGFlowCLITransformer(Transformer):
846
881
  chunk_ids = []
847
882
  doc_id = None
848
883
  for i, item in enumerate(items):
849
- if hasattr(item, 'type') and item.type == 'DOCUMENT':
884
+ if hasattr(item, "type") and item.type == "DOCUMENT":
850
885
  doc_id = items[i + 1].children[0].strip("'\"")
851
- elif hasattr(item, 'children') and item.children:
886
+ elif hasattr(item, "children") and item.children:
852
887
  val = item.children[0].strip("'\"")
853
888
  # Skip if it's "FROM" or "DOCUMENT"
854
- if val.upper() in ['FROM', 'DOCUMENT']:
889
+ if val.upper() in ["FROM", "DOCUMENT"]:
855
890
  continue
856
891
  chunk_ids.append(val)
857
892
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ragflow-cli"
3
- version = "0.26.3"
3
+ version = "0.27.0"
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" }
@@ -8,7 +8,7 @@ readme = "README.md"
8
8
  requires-python = ">=3.13,<3.14"
9
9
  dependencies = [
10
10
  "requests>=2.30.0,<3.0.0",
11
- "beartype>=0.20.0,<1.0.0",
11
+ "beartype>=0.22.9,<1.0.0",
12
12
  "pycryptodomex>=3.10.0",
13
13
  "lark>=1.1.0",
14
14
  "requests-toolbelt>=1.0.0",
@@ -20,6 +20,11 @@ test = [
20
20
  "requests>=2.32.3",
21
21
  ]
22
22
 
23
+ [tool.uv]
24
+ constraint-dependencies = [
25
+ "urllib3>=2.7.0",
26
+ ]
27
+
23
28
  [tool.setuptools]
24
29
  py-modules = ["ragflow_cli", "parser", "http_client", "ragflow_client", "user"]
25
30
 
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragflow-cli
3
- Version: 0.26.3
3
+ Version: 0.27.0
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
7
7
  Requires-Python: <3.14,>=3.13
8
8
  Description-Content-Type: text/markdown
9
9
  Requires-Dist: requests<3.0.0,>=2.30.0
10
- Requires-Dist: beartype<1.0.0,>=0.20.0
10
+ Requires-Dist: beartype<1.0.0,>=0.22.9
11
11
  Requires-Dist: pycryptodomex>=3.10.0
12
12
  Requires-Dist: lark>=1.1.0
13
13
  Requires-Dist: requests-toolbelt>=1.0.0
@@ -42,7 +42,7 @@ It consists of a server-side Service and a command-line client (CLI), both imple
42
42
  ```bash
43
43
  python admin/server/admin_server.py
44
44
  ```
45
- The service will start and listen for incoming connections from the CLI on the configured port.
45
+ The service will start and listen for incoming connections from the CLI on the configured port.
46
46
 
47
47
  #### Using docker image
48
48
 
@@ -62,7 +62,7 @@ It consists of a server-side Service and a command-line client (CLI), both imple
62
62
  1. Ensure the Admin Service is running.
63
63
  2. Install ragflow-cli.
64
64
  ```bash
65
- pip install ragflow-cli==0.26.3
65
+ pip install ragflow-cli==0.27.0
66
66
  ```
67
67
  3. Launch the CLI client:
68
68
  ```bash
@@ -72,9 +72,9 @@ It consists of a server-side Service and a command-line client (CLI), both imple
72
72
  The default password is admin.
73
73
 
74
74
  **Parameters:**
75
-
75
+
76
76
  - -h: RAGFlow admin server host address
77
-
77
+
78
78
  - -p: RAGFlow admin server port
79
79
 
80
80
 
@@ -1,5 +1,5 @@
1
1
  requests<3.0.0,>=2.30.0
2
- beartype<1.0.0,>=0.20.0
2
+ beartype<1.0.0,>=0.22.9
3
3
  pycryptodomex>=3.10.0
4
4
  lark>=1.1.0
5
5
  requests-toolbelt>=1.0.0
@@ -36,6 +36,7 @@ from user import login_user
36
36
 
37
37
  warnings.filterwarnings("ignore", category=getpass.GetPassWarning)
38
38
 
39
+
39
40
  def encrypt(input_string):
40
41
  pub = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArq9XTUSeYr2+N1h3Afl/z8Dse/2yD0ZGrKwx+EEEcdsBLca9Ynmx3nIB5obmLlSfmskLpBo0UACBmB5rEjBp2Q2f3AG3Hjd4B+gNCG6BDaawuDlgANIhGnaTLrIqWrrcm4EMzJOnAOI1fgzJRsOOUEfaS318Eq9OVO3apEyCCt0lOQK6PuksduOjVxtltDav+guVAA068NrPYmRNabVKRNLJpL8w4D44sfth5RvZ3q9t+6RTArpEtc5sh5ChzvqPOzKGMXW83C95TxmXqpbK6olN4RevSfVjEAgCydH6HN6OhtOQEcnrU97r9H0iZOWwbw3pVrZiUkuRD1R56Wzs2wIDAQAB\n-----END PUBLIC KEY-----"
41
42
  pub_key = RSA.importKey(pub)
@@ -49,9 +50,6 @@ def encode_to_base64(input_string):
49
50
  return base64_encoded.decode("utf-8")
50
51
 
51
52
 
52
-
53
-
54
-
55
53
  class RAGFlowCLI(Cmd):
56
54
  def __init__(self):
57
55
  super().__init__()
@@ -240,9 +238,9 @@ class RAGFlowCLI(Cmd):
240
238
  print(r"""
241
239
  ____ ___ ______________ ________ ____
242
240
  / __ \/ | / ____/ ____/ /___ _ __ / ____/ / / _/
243
- / /_/ / /| |/ / __/ /_ / / __ \ | /| / / / / / / / /
244
- / _, _/ ___ / /_/ / __/ / / /_/ / |/ |/ / / /___/ /____/ /
245
- /_/ |_/_/ |_\____/_/ /_/\____/|__/|__/ \____/_____/___/
241
+ / /_/ / /| |/ / __/ /_ / / __ \ | /| / / / / / / / /
242
+ / _, _/ ___ / /_/ / __/ / / /_/ / |/ |/ / / /___/ /____/ /
243
+ /_/ |_/_/ |_\____/_/ /_/\____/|__/|__/ \____/_____/___/
246
244
  """)
247
245
  self.cmdloop()
248
246
 
@@ -254,15 +252,13 @@ class RAGFlowCLI(Cmd):
254
252
  result = self.parse_command(command)
255
253
  self.execute_command(result)
256
254
 
257
-
258
255
  def parse_connection_args(self, args: List[str]) -> Dict[str, Any]:
259
256
  parser = argparse.ArgumentParser(description="RAGFlow CLI Client", add_help=False)
260
257
  parser.add_argument("-h", "--host", default="127.0.0.1", help="Admin or RAGFlow service host")
261
258
  parser.add_argument("-p", "--port", type=int, default=9381, help="Admin or RAGFlow service port")
262
259
  parser.add_argument("-w", "--password", default="admin", type=str, help="Superuser password")
263
260
  parser.add_argument("-t", "--type", default="admin", type=str, help="CLI mode, admin or user")
264
- parser.add_argument("-u", "--username", default=None,
265
- help="Username (email). In admin mode defaults to admin@ragflow.io, in user mode required.")
261
+ parser.add_argument("-u", "--username", default=None, help="Username (email). In admin mode defaults to admin@ragflow.io, in user mode required.")
266
262
  parser.add_argument("command", nargs="?", help="Single command")
267
263
  try:
268
264
  parsed_args, remaining_args = parser.parse_known_args(args)
@@ -274,7 +270,7 @@ class RAGFlowCLI(Cmd):
274
270
 
275
271
  if remaining_args:
276
272
  if remaining_args[0] == "command":
277
- command_str = ' '.join(remaining_args[1:]) + ';'
273
+ command_str = " ".join(remaining_args[1:]) + ";"
278
274
  auth = True
279
275
  if remaining_args[1] == "register":
280
276
  auth = False
@@ -282,28 +278,14 @@ class RAGFlowCLI(Cmd):
282
278
  if username is None:
283
279
  print("Error: username (-u) is required in user mode")
284
280
  return {"error": "Username required"}
285
- return {
286
- "host": parsed_args.host,
287
- "port": parsed_args.port,
288
- "password": parsed_args.password,
289
- "type": parsed_args.type,
290
- "username": username,
291
- "command": command_str,
292
- "auth": auth
293
- }
281
+ return {"host": parsed_args.host, "port": parsed_args.port, "password": parsed_args.password, "type": parsed_args.type, "username": username, "command": command_str, "auth": auth}
294
282
  else:
295
283
  return {"error": "Invalid command"}
296
284
  else:
297
285
  auth = True
298
286
  if username is None:
299
287
  auth = False
300
- return {
301
- "host": parsed_args.host,
302
- "port": parsed_args.port,
303
- "type": parsed_args.type,
304
- "username": username,
305
- "auth": auth
306
- }
288
+ return {"host": parsed_args.host, "port": parsed_args.port, "type": parsed_args.type, "username": username, "auth": auth}
307
289
  except SystemExit:
308
290
  return {"error": "Invalid connection arguments"}
309
291
 
@@ -321,6 +303,7 @@ class RAGFlowCLI(Cmd):
321
303
  # print(f"Parsed command: {command_dict}")
322
304
  run_command(self.ragflow_client, command_dict)
323
305
 
306
+
324
307
  def main():
325
308
 
326
309
  cli = RAGFlowCLI()