@@ -159,7 +159,6 @@ const initialize_chat = async (params: { message: string; chat: Chat }) => {
159159 } )
160160 }
161161
162- // User may send by pressing enter
163162 await new Promise < void > ( ( resolve ) => {
164163 const handle_key_press = ( e : KeyboardEvent ) => {
165164 if ( e . key == 'Enter' ) {
@@ -170,7 +169,6 @@ const initialize_chat = async (params: { message: string; chat: Chat }) => {
170169 document . addEventListener ( 'keydown' , handle_key_press )
171170 setTimeout ( resolve , 2000 )
172171 } )
173- // Process next chat from the queue
174172 browser . runtime . sendMessage < Message > ( {
175173 action : 'chat-initialized'
176174 } )
@@ -180,14 +178,12 @@ const main = async () => {
180178 const session_data_key = 'cwc-session-data'
181179
182180 if ( is_cwc_hash ) {
183- // Remove the hash from the URL to avoid reloading the content script if the page is refreshed
184181 history . replaceState (
185182 null ,
186183 '' ,
187184 window . location . pathname + window . location . search
188185 )
189186
190- // Get the message using the batch ID from the hash
191187 const storage_key = `chat-init:${ batch_id } `
192188 const storage = await browser . storage . local . get ( storage_key )
193189 const stored_data = storage [ storage_key ] as {
@@ -212,7 +208,6 @@ const main = async () => {
212208 return
213209 }
214210
215- // Now directly use the current_chat instead of searching for it
216211 const message_text = stored_data . text
217212 const current_chat = stored_data . current_chat
218213
@@ -230,7 +225,6 @@ const main = async () => {
230225 chat : current_chat
231226 } )
232227
233- // Clean up the storage entry after using it
234228 await browser . storage . local . remove ( storage_key )
235229
236230 if (
0 commit comments