@@ -40,56 +40,6 @@ export const grok: Chatbot = {
4040 }
4141 }
4242 } ,
43- set_model : async ( chat ) => {
44- const model = chat . model
45- if ( ! model ) return
46-
47- const model_selector_buttons = document . querySelectorAll (
48- 'button[id="model-select-trigger"]'
49- ) as NodeListOf < HTMLButtonElement >
50- if ( ! model_selector_buttons || model_selector_buttons . length == 0 ) {
51- report_initialization_error ( {
52- function_name : 'set_model' ,
53- log_message : 'Model selector button not found'
54- } )
55- return
56- }
57-
58- const model_selector_button =
59- model_selector_buttons [ model_selector_buttons . length - 1 ]
60- const model_label_to_find = CHATBOTS [ 'Grok' ] . models ?. [ model ] ?. label
61- if ( ! model_label_to_find ) return
62-
63- if ( model_selector_button . textContent == model_label_to_find ) {
64- return
65- }
66-
67- model_selector_button . dispatchEvent (
68- new PointerEvent ( 'pointerdown' , { bubbles : true } )
69- )
70- await new Promise ( ( r ) => setTimeout ( r , 150 ) )
71-
72- const dropdowns = document . querySelectorAll (
73- 'div[data-radix-popper-content-wrapper]'
74- ) as NodeListOf < HTMLDivElement >
75- const dropdown = dropdowns [ dropdowns . length - 1 ]
76- if ( ! dropdown ) {
77- report_initialization_error ( {
78- function_name : 'set_model' ,
79- log_message : 'Model dropdown not found'
80- } )
81- return
82- }
83-
84- const options = dropdown . querySelectorAll ( 'div[role="menuitem"]' )
85- for ( const option of Array . from ( options ) ) {
86- if ( option . textContent ?. startsWith ( model_label_to_find ) ) {
87- ; ( option as HTMLElement ) . click ( )
88- break
89- }
90- }
91- await new Promise ( ( r ) => setTimeout ( r , 250 ) )
92- } ,
9343 enter_message : async ( params ) => {
9444 const input_element = document . querySelector (
9545 'div[contenteditable="true"]'
0 commit comments