-
-
Notifications
You must be signed in to change notification settings - Fork 22
Feature: Allow add multiple files with /file command #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Allow add multiple files with /file command #25
Conversation
…file inputs and provide detailed processing feedback This change allows users to process multiple files in a single command, improving usability. It also adds error handling and notifications for successful and failed file processing, ensuring users receive clear feedback on the command's execution.
…y and maintainability fix(command_processor.py): ensure consistent handling of file content types and improve variable declarations
…e unused notification code to streamline the file command handling process
…e processing and simplify success notification format
| combined_parts.append(f"<file path='{file_path}'>\n{content}\n</file>") | ||
| combined_content = "\n\n".join(combined_parts) | ||
|
|
||
| message_content: Dict[str, Any] = {"role": "user", "content": [{"type": "text", "text": combined_content}]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change message_content to this format to be consistence with other messages.
I got issue that can't receive response from LLM when using previous format {"role": "user", "content": [file_content]}
| content_text: str | ||
| if isinstance(file_content, dict) and "text" in file_content: | ||
| content_text = file_content["text"] | ||
| elif isinstance(file_content, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not process file here, llm already handle the file message in agent.format_message function. only append file content to message as it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted to the previous logic, just modified
- adding a
forloop for supporting multiple files - adding type hints
- changing the message history format to
{"role": "user", "content": [{"type": "text", "text": "<file file_path=".."> .... </file>"]}
…oving unnecessary checks and consolidating logic for better readability and maintainability
9c0ac5d to
d1a4187
Compare
…s to specify it contains dictionaries and enhance file content formatting feat(command_processor.py): wrap file content with XML tags and structure it as a dictionary for better message handling
| # Process file with the file handling service | ||
| if self.message_handler.file_handler is None: | ||
| self.message_handler.file_handler = FileHandler() | ||
| file_content: Optional[Any] = self.message_handler.file_handler.process_file(file_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to define type for file_content here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| if file_content: | ||
| if file_content: | ||
| # Wrap file content with XML tags including file path | ||
| formatted_content: str = f'<file file_path="{file_path}">\n{file_content}\n</file>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
append directly the file_content value, agent and file_handler already format file content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
…emoving unnecessary variable assignments and XML formatting to enhance code clarity and maintainability
No description provided.