Skip to content

Commit 21ebf58

Browse files
committed
Update Claude response handling and add wait_until_ready for DeepSeek
- to deepseek, add the input testing in waiting method - claude is generating when there is something with this selector `div[data-cds="AssistantMessage"] div[data-cds="TurnStatus"]` └── apps └── browser └── src └── content-scripts └── send-prompt-content-script ├── chatbots │ ├── ai-studio.ts │ ├── arena.ts │ ├── chatgpt.ts │ ├── claude.ts │ ├── copilot.ts │ ├── deepseek.ts │ ├── doubao.ts │ ├── gemini.ts │ ├── github-copilot.ts │ ├── grok.ts │ ├── hugging-chat.ts │ ├── index.ts │ ├── kimi.ts │ ├── meta.ts │ ├── mistral.ts │ ├── open-webui.ts │ ├── openrouter.ts │ ├── qwen.ts │ ├── together.ts │ ├── yuanbao.ts │ └── z-ai.ts ├── constants │ ├── apply-response-icon.ts │ └── dictionary.ts ├── send-prompt-content-script.ts ├── types │ └── chatbot.ts └── utils ├── add-apply-response-button.ts ├── apply-response-styles.ts ├── logger.ts ├── report-initialization-error.ts ├── session-state.ts └── show-response-ready-notification.ts
1 parent d8a07e8 commit 21ebf58

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const claude: Chatbot = {
8888
footer,
8989
perform_copy: (f) => {
9090
const copy_button = f.querySelector(
91-
'button:first-child'
91+
'button:nth-child(2)'
9292
) as HTMLElement
9393
if (!copy_button) {
9494
report_initialization_error({
@@ -99,8 +99,7 @@ export const claude: Chatbot = {
9999
}
100100
copy_button.click()
101101
},
102-
insert_button: (f, b) =>
103-
f.insertBefore(b, f.children[f.children.length])
102+
insert_button: (f, b) => f.insertBefore(b, f.children[0])
104103
})
105104
}
106105

@@ -109,7 +108,10 @@ export const claude: Chatbot = {
109108

110109
observe_for_responses({
111110
chatbot_name: 'Claude',
112-
is_generating: () => false, // Find robust way to determine when stop button is shown
111+
is_generating: () =>
112+
!!document.querySelector(
113+
'div[data-cds="AssistantMessage"] div[data-cds="TurnStatus"]'
114+
),
113115
footer_selector,
114116
add_buttons: params.inject_button ? add_buttons : undefined
115117
})

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ import {
77
import { report_initialization_error } from '../utils/report-initialization-error'
88

99
export const deepseek: Chatbot = {
10+
wait_until_ready: async () => {
11+
await new Promise((resolve) => {
12+
const check_for_element = () => {
13+
const input_element = document.querySelector(
14+
'textarea'
15+
) as HTMLTextAreaElement
16+
17+
if (input_element) {
18+
input_element.value = ' '
19+
input_element.dispatchEvent(new Event('input', { bubbles: true }))
20+
21+
if (input_element.value === ' ') {
22+
resolve(null)
23+
return
24+
}
25+
}
26+
27+
setTimeout(check_for_element, 100)
28+
}
29+
check_for_element()
30+
})
31+
},
1032
set_options: async (chat) => {
1133
const deep_think_button = Array.from(
1234
document.querySelectorAll('div.ds-toggle-button')

0 commit comments

Comments
 (0)