|
37 | 37 | RICH_STYLE_BLUE_BOLD = Style(color="blue", bold=True) |
38 | 38 | RICH_STYLE_RED_BOLD = Style(color="red", bold=True) |
39 | 39 |
|
| 40 | +RICH_STYLE_FILE_ACCENT_BOLD = Style(color="bright_cyan", bold=True) |
| 41 | +RICH_STYLE_FILE_PATH = Style(color="bright_white", bold=False) |
| 42 | + |
40 | 43 | CODE_THEME = "lightbulb" |
41 | 44 |
|
42 | 45 |
|
@@ -74,6 +77,8 @@ def __init__(self, message_handler: MessageHandler): |
74 | 77 | self._input_stop_event = Event() |
75 | 78 | self._current_prompt_session = None |
76 | 79 |
|
| 80 | + self._added_files = [] |
| 81 | + |
77 | 82 | def listen(self, event: str, data: Any = None): |
78 | 83 | """ |
79 | 84 | Update method required by the Observer interface. Handles events from the MessageHandler. |
@@ -118,6 +123,7 @@ def listen(self, event: str, data: Any = None): |
118 | 123 | self.display_message( |
119 | 124 | Text("🎮 Chat history cleared.", style=RICH_STYLE_YELLOW_BOLD) |
120 | 125 | ) |
| 126 | + self._added_files = [] |
121 | 127 | elif event == "exit_requested": |
122 | 128 | self.display_message( |
123 | 129 | Text("🎮 Ending chat session. Goodbye!", style=RICH_STYLE_YELLOW_BOLD) |
@@ -171,9 +177,7 @@ def listen(self, event: str, data: Any = None): |
171 | 177 | self.display_divider() |
172 | 178 | elif event == "file_processed": |
173 | 179 | 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"]) |
177 | 181 | elif event == "consolidation_completed": |
178 | 182 | self.display_consolidation_result(data) |
179 | 183 | elif event == "conversations_listed": |
@@ -999,6 +1003,7 @@ def get_user_input(self): |
999 | 1003 | style=RICH_STYLE_YELLOW, |
1000 | 1004 | ) |
1001 | 1005 | self.console.print(title) |
| 1006 | + self._display_added_files() |
1002 | 1007 | self._start_input_thread() |
1003 | 1008 | else: |
1004 | 1009 | time.sleep(0.2) # prevent conflict |
@@ -1081,6 +1086,7 @@ def _print_prompt_prefix(self): |
1081 | 1086 | style=RICH_STYLE_YELLOW, |
1082 | 1087 | ) |
1083 | 1088 | self.console.print(title) |
| 1089 | + self._display_added_files() |
1084 | 1090 | prompt = Text("👤 YOU: ", style=RICH_STYLE_BLUE_BOLD) |
1085 | 1091 | self.console.print(prompt, end="") |
1086 | 1092 |
|
@@ -1185,6 +1191,23 @@ def _(event): |
1185 | 1191 |
|
1186 | 1192 | return kb |
1187 | 1193 |
|
| 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 | + |
1188 | 1211 | def print_welcome_message(self): |
1189 | 1212 | """Print the welcome message for the chat.""" |
1190 | 1213 | # Get version information |
|
0 commit comments