Skip to content

Commit dea2b77

Browse files
committed
Update Gemini selectors for the model trigger button and menu container to restore model setting functionality
1 parent 7b6cb70 commit dea2b77

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

  • packages/browser/src/content-scripts/send-prompt-content-script/chatbots

‎packages/browser/src/content-scripts/send-prompt-content-script/chatbots/gemini.ts‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const gemini: Chatbot = {
2626
if (!model) return
2727
if (model && model in CHATBOTS['Gemini'].models) {
2828
const model_selector_trigger = document.querySelector(
29-
'bard-logo + button'
29+
'bard-mode-switcher button'
3030
) as HTMLButtonElement
3131
if (!model_selector_trigger) {
3232
report_initialization_error({
@@ -36,11 +36,17 @@ export const gemini: Chatbot = {
3636
})
3737
return
3838
}
39+
40+
const model_label = (CHATBOTS['Gemini'].models as any)[model].label
41+
if (model_selector_trigger.textContent.includes(model_label)) {
42+
return
43+
}
44+
3945
model_selector_trigger.click()
4046
await new Promise((r) => requestAnimationFrame(r))
4147
const menu_content =
4248
document.querySelector('.mat-mdc-menu-content') ||
43-
document.querySelector('mat-action-list')
49+
document.querySelector('mat-bottom-sheet-container')
4450
if (!menu_content) {
4551
report_initialization_error({
4652
function_name: 'set_model',
@@ -56,11 +62,7 @@ export const gemini: Chatbot = {
5662
const name_element = option.querySelector(
5763
'.title-and-description > span:last-child'
5864
)
59-
if (
60-
name_element &&
61-
name_element.textContent?.trim() ==
62-
(CHATBOTS['Gemini'].models as any)[model].label
63-
) {
65+
if (name_element && name_element.textContent?.trim() == model_label) {
6466
;(option as HTMLElement).click()
6567
await new Promise((r) => requestAnimationFrame(r))
6668
break

0 commit comments

Comments
 (0)