@@ -48,13 +48,11 @@ const createChatMessageElement = (chatInstance) => {
48
48
}
49
49
}
50
50
51
- // Create speaker name element (only show for others, not for current user)
52
- if ( ! chatInstance . isCurrentUser ) {
53
- const speakerNameDiv = document . createElement ( "div" ) ;
54
- speakerNameDiv . classList . add ( "speakerName" ) ;
55
- speakerNameDiv . textContent = chatInstance . role ;
56
- messageDiv . appendChild ( speakerNameDiv ) ;
57
- }
51
+ // Create speaker name element (show for ALL users now, including current user)
52
+ const speakerNameDiv = document . createElement ( "div" ) ;
53
+ speakerNameDiv . classList . add ( "speakerName" ) ;
54
+ speakerNameDiv . textContent = chatInstance . role ;
55
+ messageDiv . appendChild ( speakerNameDiv ) ;
58
56
59
57
// Create chat bubble
60
58
const bubbleDiv = document . createElement ( "div" ) ;
@@ -164,21 +162,17 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
164
162
} ) ;
165
163
}
166
164
165
+ // Clear the entire container and recreate all messages for consistent styling
166
+ chatContainer . innerHTML = '' ;
167
+
168
+ // Recreate all messages with consistent styling
167
169
chat . forEach ( ( chatInstance ) => {
168
- const existingElement = document . querySelector ( `[ticId="${ chatInstance . ticId } "]` ) ;
169
-
170
- if ( ! existingElement ) {
171
- // Create new message element
172
- const messageElement = createChatMessageElement ( chatInstance ) ;
173
- chatContainer . appendChild ( messageElement ) ;
174
- } else {
175
- // Update existing message content
176
- const bubbleElement = existingElement . querySelector ( '.chatBubble' ) ;
177
- if ( bubbleElement ) {
178
- bubbleElement . textContent = chatInstance . content ;
179
- }
180
- }
170
+ const messageElement = createChatMessageElement ( chatInstance ) ;
171
+ chatContainer . appendChild ( messageElement ) ;
181
172
} ) ;
173
+
174
+ // Reapply selection highlighting if any
175
+ reactToSelectedChats ( ) ;
182
176
}
183
177
if ( request . type === "CHATGPT_RESPONSE" ) {
184
178
responseStartContentEx . innerText = chat [ request . data . startChat ] . content ;
0 commit comments