Skip to content

Commit 2e82873

Browse files
committed
Update Qwen and Yuanbao chatbot implementations to match UI changes and remove deprecated model configurations
1 parent 7be99a8 commit 2e82873

3 files changed

Lines changed: 29 additions & 127 deletions

File tree

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

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -84,53 +84,44 @@ export const qwen: Chatbot = {
8484
if (!options) return
8585
const supported_options = CHATBOTS['Qwen'].supported_options
8686
for (const option of options) {
87-
if (option == 'thinking' && supported_options?.['thinking']) {
88-
const buttons = document.querySelectorAll(
89-
'.chat-message-input button.chat-input-feature-btn'
90-
) as NodeListOf<HTMLButtonElement>
91-
for (const button of Array.from(buttons)) {
92-
if (button.querySelector('i.icon-line-deepthink-01')) {
93-
button.click()
94-
}
95-
}
96-
} else if (option == 'search' && supported_options?.['search']) {
97-
const search_button = document.querySelector(
98-
'button.websearch_button'
87+
if (option == 'temporary' && supported_options?.['temporary']) {
88+
const temporary_button = document.querySelector(
89+
'.temporary-chat-entry'
9990
) as HTMLButtonElement
100-
if (!search_button) {
91+
if (!temporary_button) {
10192
report_initialization_error({
10293
function_name: 'set_options',
103-
log_message: 'Search button not found'
94+
log_message: 'Temporary chat button not found'
10495
})
10596
return
10697
}
107-
search_button.click()
108-
} else if (option == 'temporary' && supported_options?.['temporary']) {
109-
const model_selector_button = document.querySelector(
110-
'button#model-selector-0-button'
111-
) as HTMLElement
112-
if (!model_selector_button) {
98+
temporary_button.click()
99+
await new Promise((r) => requestAnimationFrame(r))
100+
} else if (option == 'thinking' && supported_options?.['thinking']) {
101+
const thinking_button = document.querySelector(
102+
'.chat-message-input-thinking-budget-btn > div'
103+
) as HTMLDivElement
104+
if (!thinking_button) {
113105
report_initialization_error({
114106
function_name: 'set_options',
115-
log_message: 'Model selector button for temporary chat not found'
107+
log_message: 'Thinking button not found'
116108
})
117109
return
118110
}
119-
model_selector_button.click()
111+
thinking_button.click()
120112
await new Promise((r) => requestAnimationFrame(r))
121-
const temporary_switch = document.querySelector(
122-
'div[aria-labelledby="model-selector-0-button"] button[role="switch"]'
123-
) as HTMLButtonElement
124-
if (!temporary_switch) {
113+
} else if (option == 'search' && supported_options?.['search']) {
114+
const search_button = document.querySelector(
115+
'.chat-message-input-thinking-budget-btn + div'
116+
) as HTMLDivElement
117+
if (!search_button) {
125118
report_initialization_error({
126119
function_name: 'set_options',
127-
log_message: 'Temporary chat switch not found'
120+
log_message: 'Search button not found'
128121
})
129122
return
130123
}
131-
temporary_switch.click()
132-
await new Promise((r) => requestAnimationFrame(r))
133-
model_selector_button.click()
124+
search_button.click()
134125
await new Promise((r) => requestAnimationFrame(r))
135126
}
136127
}

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

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { CHATBOTS } from '@shared/constants/chatbots'
21
import { Chatbot } from '../types/chatbot'
32
import {
43
add_apply_response_button,
@@ -20,80 +19,6 @@ export const yuanbao: Chatbot = {
2019
})
2120
await new Promise((resolve) => setTimeout(resolve, 500))
2221
},
23-
set_model: async (chat) => {
24-
const model = chat.model
25-
if (!model) return
26-
const model_selector_button = document.querySelector(
27-
'button[dt-button-id="model_switch"]'
28-
) as HTMLElement
29-
if (!model_selector_button) {
30-
report_initialization_error({
31-
function_name: 'set_model',
32-
log_message: 'Model selector button not found'
33-
})
34-
return
35-
}
36-
model_selector_button.click()
37-
await new Promise((r) => requestAnimationFrame(r))
38-
const model_buttons = document.querySelectorAll(
39-
'.switch-model-dropdown .drop-down-item'
40-
) as NodeListOf<HTMLButtonElement>
41-
for (const button of Array.from(model_buttons)) {
42-
const model_name_element = button.querySelector(
43-
'.drop-down-item__name'
44-
) as HTMLDivElement
45-
if (
46-
model_name_element?.textContent ==
47-
CHATBOTS['Yuanbao'].models?.[model]?.label
48-
) {
49-
button.click()
50-
break
51-
}
52-
}
53-
await new Promise((r) => requestAnimationFrame(r))
54-
},
55-
set_options: async (chat) => {
56-
const options = chat.options
57-
if (!options) return
58-
const supported_options = CHATBOTS['Yuanbao'].supported_options
59-
60-
if (supported_options?.['deep-think']) {
61-
const deep_think_button = document.querySelector(
62-
'button[dt-button-id="deep_think"]'
63-
) as HTMLButtonElement
64-
if (!deep_think_button) {
65-
report_initialization_error({
66-
function_name: 'set_options',
67-
log_message: 'Deep think button not found'
68-
})
69-
return
70-
}
71-
const is_checked = deep_think_button.classList.contains('checked')
72-
const should_be_checked = options.includes('deep-think')
73-
if (is_checked !== should_be_checked) {
74-
deep_think_button.click()
75-
}
76-
}
77-
78-
if (supported_options?.['search']) {
79-
const search_button = document.querySelector(
80-
'button[dt-button-id="online_search"]'
81-
) as HTMLButtonElement
82-
if (!search_button) {
83-
report_initialization_error({
84-
function_name: 'set_options',
85-
log_message: 'Search button not found'
86-
})
87-
return
88-
}
89-
const is_checked = search_button.classList.contains('checked')
90-
const should_be_checked = options.includes('search')
91-
if (is_checked !== should_be_checked) {
92-
search_button.click()
93-
}
94-
}
95-
await new Promise((r) => requestAnimationFrame(r))
96-
},
9722
enter_message: async (params) => {
9823
const input_element = document.querySelector(
9924
'div[contenteditable="true"]'

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

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -206,38 +206,24 @@ export const CHATBOTS = {
206206
thinking: 'Thinking',
207207
search: 'Search',
208208
temporary: 'Temporary'
209-
},
210-
models: {
211-
'qwen3-max': { label: 'Qwen3-Max' },
212-
'qwen3-vl-235b-a22b': { label: 'Qwen3-VL-235B-A22B' },
213-
'qwen3-coder': { label: 'Qwen3-Coder' },
214-
'qwen3-omni-flash': { label: 'Qwen3-Omni-Flash' },
215-
'qwen3-next-80b-a3b': { label: 'Qwen3-Next-80B-A3B' },
216-
'qwen3-235b-a22b-2507': { label: 'Qwen3-235B-A22B-2507' },
217-
'qwen3-30b-a3b-2507': { label: 'Qwen3-30B-A3B-2507' },
218-
'qwen3-coder-flash': { label: 'Qwen3-Coder-Flash' }
219209
}
220210
} as Chatbot,
221211
Together: {
222212
url: 'https://chat.together.ai/',
223213
models: {
224214
'deepseek-r1-0528': { label: 'DeepSeek R1 (0528)' },
225-
'deepseek-v3-0324': { label: 'DeepSeek V3 (0324)' },
226-
'gpt-oss-120b': { label: 'GPT OSS 120B' },
215+
'deepseek-v3.1': { label: 'DeepSeek V3.1' },
216+
'glm-4.6': { label: 'GLM-4.6' },
217+
'kimi-k2-thinking': { label: 'Kimi K2 Thinking' },
227218
'kimi-k2-instruct-0905': { label: 'Kimi K2 Instruct (0905)' },
228-
'qwen3-235b-a22b-2507': { label: 'Qwen3 235B (2507)' },
229-
'qwen3-coder-480b': { label: 'Qwen3 Coder 480B' },
230-
'glm-4.5-air': { label: 'GLM-4.5-Air' },
231-
'llama-4-maverick': { label: 'Llama 4 Maverick' }
219+
'gpt-oss-120b': { label: 'GPT OSS 120B' },
220+
'llama-4-maverick': { label: 'Llama 4 Maverick' },
221+
'flux-dev': { label: 'Flux Dev' },
222+
'flux-kontext-pro': { label: 'Flux Kontext [Pro]' }
232223
}
233224
} as Chatbot,
234225
Yuanbao: {
235-
url: 'https://yuanbao.tencent.com/chat',
236-
supported_options: { 'deep-think': 'DeepThink', search: 'Search' },
237-
models: {
238-
deepseek: { label: 'DeepSeek' },
239-
hunyuan: { label: 'Hunyuan' }
240-
}
226+
url: 'https://yuanbao.tencent.com/chat'
241227
} as Chatbot,
242228
'Z.AI': {
243229
url: 'https://chat.z.ai/',

0 commit comments

Comments
 (0)