Skip to content

Commit 2a46671

Browse files
committed
feat(console_ui.py): add display for added files with special styling to enhance user experience
fix(command_processor.py): prepend success message with a checkmark for better visibility
1 parent d4f9404 commit 2a46671

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

AgentCrew/modules/chat/console_ui.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
RICH_STYLE_BLUE_BOLD = Style(color="blue", bold=True)
3838
RICH_STYLE_RED_BOLD = Style(color="red", bold=True)
3939

40+
RICH_STYLE_FILE_ACCENT_BOLD = Style(color="bright_cyan", bold=True)
41+
RICH_STYLE_FILE_PATH = Style(color="bright_white", bold=False)
42+
4043
CODE_THEME = "lightbulb"
4144

4245

@@ -74,6 +77,8 @@ def __init__(self, message_handler: MessageHandler):
7477
self._input_stop_event = Event()
7578
self._current_prompt_session = None
7679

80+
self._added_files = []
81+
7782
def listen(self, event: str, data: Any = None):
7883
"""
7984
Update method required by the Observer interface. Handles events from the MessageHandler.
@@ -118,6 +123,7 @@ def listen(self, event: str, data: Any = None):
118123
self.display_message(
119124
Text("🎮 Chat history cleared.", style=RICH_STYLE_YELLOW_BOLD)
120125
)
126+
self._added_files = []
121127
elif event == "exit_requested":
122128
self.display_message(
123129
Text("🎮 Ending chat session. Goodbye!", style=RICH_STYLE_YELLOW_BOLD)
@@ -171,9 +177,7 @@ def listen(self, event: str, data: Any = None):
171177
self.display_divider()
172178
elif event == "file_processed":
173179
self.stop_loading_animation() # Stop loading on first chunk
174-
file_text = Text("Processed file: ", style=RICH_STYLE_YELLOW)
175-
file_text.append(data["file_path"])
176-
self.display_message(file_text)
180+
self._added_files.append(data["file_path"])
177181
elif event == "consolidation_completed":
178182
self.display_consolidation_result(data)
179183
elif event == "conversations_listed":
@@ -999,6 +1003,7 @@ def get_user_input(self):
9991003
style=RICH_STYLE_YELLOW,
10001004
)
10011005
self.console.print(title)
1006+
self._display_added_files()
10021007
self._start_input_thread()
10031008
else:
10041009
time.sleep(0.2) # prevent conflict
@@ -1081,6 +1086,7 @@ def _print_prompt_prefix(self):
10811086
style=RICH_STYLE_YELLOW,
10821087
)
10831088
self.console.print(title)
1089+
self._display_added_files()
10841090
prompt = Text("👤 YOU: ", style=RICH_STYLE_BLUE_BOLD)
10851091
self.console.print(prompt, end="")
10861092

@@ -1185,6 +1191,23 @@ def _(event):
11851191

11861192
return kb
11871193

1194+
def _display_added_files(self):
1195+
"""Display added files with special styling just above the user input."""
1196+
if not self._added_files:
1197+
return
1198+
1199+
file_display = Text("📎 Added files: ", style=RICH_STYLE_FILE_ACCENT_BOLD)
1200+
for i, file_path in enumerate(self._added_files):
1201+
if i > 0:
1202+
file_display.append(", ", style=RICH_STYLE_FILE_PATH)
1203+
if ' ' in file_path:
1204+
file_display.append(f'"{file_path}"', style=RICH_STYLE_FILE_PATH)
1205+
else:
1206+
file_display.append(file_path, style=RICH_STYLE_FILE_PATH)
1207+
1208+
self.console.print(file_display)
1209+
print()
1210+
11881211
def print_welcome_message(self):
11891212
"""Print the welcome message for the chat."""
11901213
# Get version information

AgentCrew/modules/chat/message/command_processor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from AgentCrew.modules.config import ConfigManagement
1111
from AgentCrew.modules.mcpclient import MCPService
1212
import shlex
13+
from rich.text import Text
14+
from rich.style import Style
1315

1416

1517
@dataclass
@@ -503,7 +505,7 @@ def _handle_file_command(self, user_input: str) -> CommandResult:
503505
)
504506
self.message_handler._notify(
505507
"system_message",
506-
f"Successfully processed {len(processed_files)} files: {', '.join(processed_files)}",
508+
f"Successfully processed {len(processed_files)} files: {', '.join(processed_files)}",
507509
)
508510

509511
return CommandResult(handled=True, clear_flag=True)

0 commit comments

Comments
 (0)