From 1a3ba34a9022aa56df8198617bb83807e4f2b95e Mon Sep 17 00:00:00 2001 From: lidia9 Date: Tue, 29 Apr 2025 13:09:14 +0200 Subject: [PATCH] for empty messages do not display token info --- src/cai/util.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cai/util.py b/src/cai/util.py index b772437a..0736add3 100644 --- a/src/cai/util.py +++ b/src/cai/util.py @@ -831,6 +831,13 @@ def cli_print_agent_messages(agent_name, message, counter, model, debug, # pyli text.append(f" ({os.getenv('CAI_SUPPORT_MODEL')})", style="bold blue") text.append("]", style="dim") + elif not parsed_message: + # When parsed_message is empty, only include timestamp and model info + text.append(f"Agent: {agent_name} ", style="bold green") + text.append(f"[{timestamp}", style="dim") + if model: + text.append(f" ({model})", style="bold magenta") + text.append("]", style="dim") else: text.append(f"[{counter}] ", style="bold cyan") text.append(f"Agent: {agent_name} ", style="bold green") @@ -861,7 +868,9 @@ def cli_print_agent_messages(agent_name, message, counter, model, debug, # pyli interaction_cost, total_cost ) - text.append(tokens_text) + # Only append token information if there is a parsed message + if parsed_message: + text.append(tokens_text) panel = Panel( text,