Skip to content

Commit 7f325e2

Browse files
committed
Update Open WebUI selectors and input handling logic, and rename the root package to cwc
1 parent 330fd95 commit 7f325e2

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/open-webui.ts‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const open_webui: Chatbot = {
116116
return
117117
}
118118
const temperature_div = pb_safe_bottom.querySelector(
119-
'div:nth-child(5)'
119+
'div:nth-child(7)'
120120
) as HTMLElement
121121
if (!temperature_div) {
122122
report_initialization_error({
@@ -144,7 +144,7 @@ export const open_webui: Chatbot = {
144144
return
145145
}
146146
input.value = temperature.toString()
147-
input.dispatchEvent(new Event('change', { bubbles: true }))
147+
input.dispatchEvent(new Event('input', { bubbles: true }))
148148
const close_button = controls_pane.querySelector(
149149
'button'
150150
) as HTMLButtonElement
@@ -223,7 +223,7 @@ export const open_webui: Chatbot = {
223223
return
224224
}
225225
input.value = top_p.toString()
226-
input.dispatchEvent(new Event('change', { bubbles: true }))
226+
input.dispatchEvent(new Event('input', { bubbles: true }))
227227
const close_button = controls_pane.querySelector(
228228
'button'
229229
) as HTMLButtonElement
@@ -277,20 +277,19 @@ export const open_webui: Chatbot = {
277277
await new Promise((r) => requestAnimationFrame(r))
278278
},
279279
enter_message: async (params) => {
280-
const input_element = document.querySelector(
281-
'textarea#chat-input-0'
282-
) as HTMLTextAreaElement
280+
const input_element = document.querySelector('#chat-input') as HTMLElement
281+
283282
if (!input_element) {
284283
report_initialization_error({
285284
function_name: 'open_webui.enter_message',
286-
log_message: 'Message input textarea not found'
285+
log_message: 'Message input not found'
287286
})
288287
return
289288
}
290-
input_element.value = params.message
289+
290+
input_element.innerText = params.message
291291
input_element.dispatchEvent(new Event('input', { bubbles: true }))
292-
input_element.dispatchEvent(new Event('change', { bubbles: true }))
293-
await new Promise((r) => requestAnimationFrame(r))
292+
input_element.focus()
294293
},
295294
inject_apply_response_button: (
296295
client_id: number,

‎package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
2-
"name": "code-web-chat",
3-
"description": "Monorepo containing editor and browser extensions",
2+
"name": "cwc",
43
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39",
54
"devDependencies": {
65
"@types/jest": "^29.5.14",

0 commit comments

Comments
 (0)