File tree Expand file tree Collapse file tree
content-scripts/send-prompt-content-script Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -424,7 +424,6 @@ export const ai_studio: Chatbot = {
424424 // AI Studio is quite sluggish with showing already generated tokens,
425425 // therefore we handle waiting for finished response differently than
426426 // in other chatbots.
427- let has_sent_finished_responding = true
428427 let debounce_timer : NodeJS . Timeout
429428 const observer = new MutationObserver ( ( ) => {
430429 clearTimeout ( debounce_timer )
Original file line number Diff line number Diff line change @@ -27,11 +27,7 @@ import {
2727// In case url changes on load
2828const current_url = window . location . href
2929
30- const hash = window . location . hash
3130const hash_prefix_new = '#cwc'
32- const is_cwc_hash = hash . startsWith ( hash_prefix_new )
33-
34- const batch_id = hash . substring ( hash_prefix_new . length + 1 )
3531
3632const ai_studio_url = 'https://aistudio.google.com/'
3733const is_ai_studio = current_url . startsWith ( ai_studio_url )
@@ -177,6 +173,10 @@ const initialize_chat = async (params: { message: string; chat: Chat }) => {
177173const main = async ( ) => {
178174 const session_data_key = 'cwc-session-data'
179175
176+ const hash = window . location . hash
177+ const is_cwc_hash = hash . startsWith ( hash_prefix_new )
178+ const batch_id = hash . substring ( hash_prefix_new . length + 1 )
179+
180180 if ( is_cwc_hash ) {
181181 history . replaceState (
182182 null ,
@@ -271,6 +271,13 @@ const main = async () => {
271271 }
272272}
273273
274+ // Hash changes when reusing a tab
275+ window . addEventListener ( 'hashchange' , ( ) => {
276+ if ( window . location . hash . startsWith ( hash_prefix_new ) ) {
277+ main ( )
278+ }
279+ } )
280+
274281if ( document . readyState == 'loading' ) {
275282 document . addEventListener ( 'DOMContentLoaded' , main )
276283} else {
Original file line number Diff line number Diff line change 44 "name" : " Autofill for Code Web Chat" ,
55 "short_name" : " CWC" ,
66 "description" : " Got tired with copy and paste? Enable prompt autofill!" ,
7- "version" : " 1.110 .0" ,
7+ "version" : " 1.111 .0" ,
88 "homepage_url" : " https://github.com/robertpiosik/CodeWebChat" ,
99 "icons" : {
1010 "16" : " icons/icon-16.png" ,
You can’t perform that action at this time.
0 commit comments