Skip to content

Commit 3efeced

Browse files
committed
Refactor Gemini chatbot model selection logic and update Gemini model names to "Fast" and "Thinking."
1 parent 1e56d70 commit 3efeced

4 files changed

Lines changed: 9 additions & 12 deletions

File tree

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export const gemini: Chatbot = {
2020
})
2121
},
2222
set_model: async (model?: string) => {
23-
if (!model) return
2423
if (model && model in CHATBOTS['Gemini'].models) {
2524
const model_selector_trigger = document.querySelector(
2625
'bard-mode-switcher button'
@@ -34,7 +33,7 @@ export const gemini: Chatbot = {
3433
}
3534

3635
const model_label = (CHATBOTS['Gemini'].models as any)[model].label
37-
if (model_selector_trigger.textContent.includes(model_label)) {
36+
if (model_selector_trigger.textContent == model_label) {
3837
return
3938
}
4039

@@ -50,12 +49,10 @@ export const gemini: Chatbot = {
5049
})
5150
return
5251
}
53-
const model_options = Array.from(
54-
menu_content.querySelectorAll('button[mat-menu-item]')
55-
)
52+
const model_options = Array.from(menu_content.querySelectorAll('button'))
5653
for (const option of model_options) {
5754
const name_element = option.querySelector(
58-
'.title-and-description > span:last-child'
55+
'.title-and-description > span:first-child'
5956
)
6057
if (name_element && name_element.textContent?.trim() == model_label) {
6158
;(option as HTMLElement).click()
@@ -107,7 +104,7 @@ export const gemini: Chatbot = {
107104
temp_chat_button.click()
108105
await new Promise((r) => requestAnimationFrame(r))
109106

110-
if (side_nav_menu_button_clicked) {
107+
if (side_nav_menu_button_clicked && window.innerWidth >= 960) {
111108
const side_nav_menu_button = document.querySelector(
112109
side_nav_menu_button_selector
113110
) as HTMLButtonElement

‎packages/browser/src/manifest.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"author": "Robert Piosik",
44
"name": "Code Web Chat Connector",
55
"short_name": "CWC",
6-
"description": "Connect your editor with free chatbots. Parse websites for context.",
7-
"version": "1.63.0",
6+
"description": "CWC lets you send selected files and instructions to chatbots and model providers",
7+
"version": "1.64.0",
88
"homepage_url": "https://github.com/robertpiosik/CodeWebChat",
99
"icons": {
1010
"16": "icons/icon-16.png",

‎packages/shared/src/constants/chatbots.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ export const CHATBOTS = {
172172
default_system_instructions: '',
173173
default_top_p: 0,
174174
models: {
175-
'2.5-flash': { label: '2.5 Flash' },
176-
'2.5-pro': { label: '2.5 Pro' }
175+
fast: { label: 'Fast' },
176+
thinking: { label: 'Thinking' }
177177
}
178178
},
179179
'GitHub Copilot': {

‎packages/vscode/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
44
"description": "AI coding without agents (CWC)",
5-
"version": "1.562.0",
5+
"version": "1.563.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",

0 commit comments

Comments
 (0)