From 071ea9c49330e1eddd135ed6daece367d00a83c0 Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 15 Oct 2025 14:57:44 +0800 Subject: [PATCH] Fix: support auto width when print table (#10575) ### What problem does this PR solve? Print table support auto width. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- admin/client/admin_client.py | 6 +++--- admin/client/pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/client/admin_client.py b/admin/client/admin_client.py index 5dd1dc45f..9ff0f7f10 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 120327afa..6f79b07a2 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 = "lynn_inf@hotmail.com" }] license = { text = "Apache License, Version 2.0" }