@@ -11,19 +11,19 @@ export const chatgpt: Chatbot = {
1111 await new Promise ( ( resolve ) => {
1212 const check_for_element = ( ) => {
1313 const input_element = document . querySelector (
14- 'div#prompt-textarea '
14+ 'div[contenteditable="true"] '
1515 ) as HTMLElement
1616
17- const thread_header_button = document . querySelector (
18- 'div[data-testid="thread-header-right-actions"] > div:first-child button'
19- )
17+ // const thread_header_button = document.querySelector(
18+ // 'div[data-testid="thread-header-right-actions"] > div:first-child button'
19+ // )
2020
21- const reasoning_effort_button = document . querySelector (
22- 'div[data-composer-transition-slot="trailing"] > div:first-child button'
23- )
21+ // const reasoning_effort_button = document.querySelector(
22+ // 'div[data-composer-transition-slot="trailing"] > div:first-child button'
23+ // )
2424
25- const is_ready =
26- thread_header_button !== null || reasoning_effort_button !== null
25+ const is_ready = true
26+ // thread_header_button !== null || reasoning_effort_button !== null
2727
2828 if ( input_element && is_ready ) {
2929 input_element . innerText = ' '
@@ -147,7 +147,7 @@ export const chatgpt: Chatbot = {
147147 for ( const option of options ) {
148148 if ( option == 'temporary' && supported_options ?. [ 'temporary' ] ) {
149149 const button = document . querySelector (
150- '#conversation- header-actions button'
150+ '[data-testid="app-shell- header-context-menu-surface"] > div:last-child > div:last-child button'
151151 )
152152 let found = false
153153 if ( button ) {
@@ -172,55 +172,12 @@ export const chatgpt: Chatbot = {
172172 // Don't show alert because temporary mode doesn't work in projects (url override)
173173 } )
174174 }
175- } else if (
176- option == 'think (free)' &&
177- supported_options ?. [ 'think (free)' ]
178- ) {
179- const think_icon_path = document . querySelector (
180- 'path[d^="M14.8974 2.29998"]'
181- )
182- if ( think_icon_path ) {
183- const think_button = think_icon_path . closest (
184- 'button'
185- ) as HTMLButtonElement
186- if ( think_button ) {
187- think_button . click ( )
188- }
189- } else {
190- const plus_button = document . querySelector (
191- '[data-testid="composer-plus-btn"]'
192- ) as HTMLButtonElement
193- if ( plus_button ) {
194- plus_button . dispatchEvent (
195- new PointerEvent ( 'pointerdown' , {
196- bubbles : true
197- } )
198- )
199- await new Promise ( ( resolve ) => requestAnimationFrame ( resolve ) )
200- const thinking_menuitem = Array . from (
201- document . querySelectorAll ( '[role="menuitemradio"]' )
202- ) . find ( ( el ) => el . textContent ?. includes ( 'Thinking' ) ) as HTMLElement
203- if ( thinking_menuitem ) {
204- thinking_menuitem . click ( )
205- } else {
206- report_initialization_error ( {
207- function_name : 'set_options' ,
208- log_message : 'Thinking menu item not found'
209- } )
210- }
211- } else {
212- report_initialization_error ( {
213- function_name : 'set_options' ,
214- log_message : 'Think button icon not found'
215- } )
216- }
217- }
218175 }
219176 }
220177 } ,
221178 enter_message : async ( params ) => {
222179 const input_element = document . querySelector (
223- 'div#prompt-textarea '
180+ 'div[contenteditable="true"] '
224181 ) as HTMLTextAreaElement
225182 if ( ! input_element ) {
226183 report_initialization_error ( {
@@ -240,7 +197,7 @@ export const chatgpt: Chatbot = {
240197 footer,
241198 perform_copy : ( f ) => {
242199 const copy_button = f . querySelector (
243- 'button[data-testid="copy-turn-action-button"] '
200+ 'button:first-child '
244201 ) as HTMLElement
245202 if ( ! copy_button ) {
246203 report_initialization_error ( {
@@ -259,8 +216,11 @@ export const chatgpt: Chatbot = {
259216 observe_for_responses ( {
260217 chatbot_name : 'ChatGPT' ,
261218 is_generating : ( ) =>
262- ! ! document . querySelector ( 'button[data-testid="stop-button"]' ) ,
263- footer_selector : '.agent-turn > div:nth-of-type(2) > div' ,
219+ ! ! document . querySelector (
220+ 'button path[d="M4.5 5.75C4.5 5.05964 5.05964 4.5 5.75 4.5H14.25C14.9404 4.5 15.5 5.05964 15.5 5.75V14.25C15.5 14.9404 14.9404 15.5 14.25 15.5H5.75C5.05964 15.5 4.5 14.9404 4.5 14.25V5.75Z"]'
221+ ) ,
222+ footer_selector :
223+ 'div[data-talvt-turn-state="complete"] > div:last-child > div' ,
264224 add_buttons : params . inject_button ? add_buttons : undefined
265225 } )
266226 }
0 commit comments