Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: support auto width when print table (#10575)

Lynn071ea9c49330
diff --git a/admin/client/admin_client.py b/admin/client/admin_client.py
index 5dd1dc45f3..9ff0f7f10f 100644
--- a/admin/client/admin_client.py
+++ b/admin/client/admin_client.py
@@ -341,9 +341,9 @@ class AdminCLI(Cmd):
row = "|"
for col in columns:
value = str(item.get(col, ''))
- if len(value) > col_widths[col]:
+ if get_string_width(value) > col_widths[col]:
value = value[:col_widths[col] - 3] + "..."
- row += f" {value:<{col_widths[col]}} |"
+ row += f" {value:<{col_widths[col] - (get_string_width(value) - len(value))}} |"
print(row)
print(separator)
@@ -452,7 +452,7 @@ class AdminCLI(Cmd):
if response.status_code == 200:
self._print_table_simple(res_json['data'])
else:
- print(f"Fail to get all users, code: {res_json['code']}, message: {res_json['message']}")
+ print(f"Fail to get all services, code: {res_json['code']}, message: {res_json['message']}")
def _handle_show_service(self, command):
service_id: int = command['number']
diff --git a/admin/client/pyproject.toml b/admin/client/pyproject.toml
index 120327afa4..6f79b07a21 100644
--- a/admin/client/pyproject.toml
+++ b/admin/client/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "ragflow-cli"
-version = "0.21.0.dev5"
+version = "0.21.0.dev9"
description = "Admin Service's client of [RAGFlow](https://github.com/infiniflow/ragflow). The Admin Service provides user management and system monitoring. "
authors = [{ name = "Lynn", email = "[email protected]" }]
license = { text = "Apache License, Version 2.0" }