Skip to content

Commit 950a294

Browse files
committed
Update selectors and button insertion logic for Claude and Perplexity apply response buttons
1 parent c1a8f81 commit 950a294

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const claude: Chatbot = {
152152
raw_instructions,
153153
edit_format,
154154
footer,
155-
get_chat_turn: (f) => f.closest('div[data-is-streaming="false"]'),
155+
get_chat_turn: (f) => f.closest('.group'),
156156
perform_copy: (f) => {
157157
const copy_button = f.querySelector(
158158
'button[data-testid="action-bar-copy"]'
@@ -166,14 +166,14 @@ export const claude: Chatbot = {
166166
}
167167
copy_button.click()
168168
},
169-
insert_button: (f, b) => f.insertBefore(b, f.children[0])
169+
insert_button: (f, b) =>
170+
f.insertBefore(b, f.children[f.children.length])
170171
})
171172
}
172173

173174
const stop_button_selector =
174175
'path[d="M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm40-112v56a12,12,0,0,1-12,12H100a12,12,0,0,1-12-12V100a12,12,0,0,1,12-12h56A12,12,0,0,1,168,100Z"]'
175-
const footer_selector =
176-
'div[data-is-streaming="false"] > div:nth-child(2) > div > div'
176+
const footer_selector = 'div[data-is-streaming="false"] + div > div > div'
177177

178178
observe_for_responses({
179179
chatbot_name: 'Claude',

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export const perplexity: Chatbot = {
197197
get_chat_turn: (f) => f.closest('.max-w-threadContentWidth'),
198198
perform_copy: (f) => {
199199
const copy_button = f.querySelector(
200-
'button:nth-child(4)'
200+
'button:nth-child(3)'
201201
) as HTMLButtonElement
202202
if (!copy_button) {
203203
report_initialization_error({
@@ -208,7 +208,8 @@ export const perplexity: Chatbot = {
208208
}
209209
copy_button.click()
210210
},
211-
insert_button: (f, b) => f.insertBefore(b, f.children[0])
211+
insert_button: (f, b) =>
212+
f.insertBefore(b, f.children[f.children.length])
212213
})
213214
}
214215

0 commit comments

Comments
 (0)