Skip to content

Commit f530bd3

Browse files
committed
separate failed files notify
1 parent ab65cf1 commit f530bd3

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

AgentCrew/modules/chat/message/command_processor.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,12 @@ def _handle_file_command(self, user_input: str) -> CommandResult:
441441
"""Handle file command with support for multiple files."""
442442
# Extract file paths from user input (space-separated)
443443
file_paths_str: str = user_input[6:].strip()
444-
file_paths: List[str] = [os.path.expanduser(path.strip()) for path in file_paths_str.split() if path.strip()]
445-
444+
file_paths: List[str] = [
445+
os.path.expanduser(path.strip())
446+
for path in file_paths_str.split()
447+
if path.strip()
448+
]
449+
446450
if not file_paths:
447451
self.message_handler._notify("error", "No file paths provided")
448452
return CommandResult(handled=True, clear_flag=True)
@@ -459,7 +463,7 @@ def _handle_file_command(self, user_input: str) -> CommandResult:
459463
if self.message_handler.file_handler is None:
460464
self.message_handler.file_handler = FileHandler()
461465
file_content = self.message_handler.file_handler.process_file(file_path)
462-
466+
463467
# Fallback to llm handle
464468
if not file_content:
465469
from AgentCrew.modules.agents.base import MessageType
@@ -490,17 +494,15 @@ def _handle_file_command(self, user_input: str) -> CommandResult:
490494
self.message_handler._messages_append(
491495
{"role": "user", "content": all_file_contents}
492496
)
493-
497+
494498
# Notify about overall processing results
495499
if failed_files:
496500
self.message_handler._notify(
497-
"system_message",
498-
f"Processed {len(processed_files)} files successfully. Failed to process: {', '.join(failed_files)}"
499-
)
500-
else:
501-
self.message_handler._notify(
502-
"system_message",
503-
f"Successfully processed {len(processed_files)} files: {', '.join(processed_files)}"
501+
"error", f"Failed to process: {', '.join(failed_files)}"
504502
)
503+
self.message_handler._notify(
504+
"system_message",
505+
f"Successfully processed {len(processed_files)} files: {', '.join(processed_files)}",
506+
)
505507

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

0 commit comments

Comments
 (0)