Skip to content

Commit 5ffa0a3

Browse files
committed
Fix copy button selectors and message input handling in GitHub Copilot and Grok content scripts
- in `apps/browser/src/content-scripts/send-prompt-content-script/chatbots/grok.ts`, implement wait until ready with the approach seen in `apps/browser/src/content-scripts/send-prompt-content-script/chatbots/chatgpt.ts` └── apps └── browser └── src └── content-scripts └── send-prompt-content-script └── chatbots ├── chatgpt.ts └── grok.ts
1 parent 2bca34a commit 5ffa0a3

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const github_copilot: Chatbot = {
4242
get_chat_turn: (f) => f.closest('div.message-container') as HTMLElement,
4343
perform_copy: (f) => {
4444
const copy_button = f.querySelector(
45-
'button:nth-child(5)'
45+
'button:nth-of-type(3)'
4646
) as HTMLElement
4747
if (!copy_button) {
4848
report_initialization_error({

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const grok: Chatbot = {
1818
}
1919
check_for_element()
2020
})
21-
await new Promise((r) => setTimeout(r, 500))
2221
},
2322
set_options: async (chat) => {
2423
const options = chat.options
@@ -52,7 +51,7 @@ export const grok: Chatbot = {
5251
return
5352
}
5453

55-
input_element.textContent = params.message
54+
input_element.innerText = params.message
5655
input_element.dispatchEvent(new Event('input', { bubbles: true }))
5756
input_element.focus()
5857
},
@@ -65,7 +64,7 @@ export const grok: Chatbot = {
6564
get_chat_turn: (f) => f.closest('.items-start'),
6665
perform_copy: (f) => {
6766
const copy_button = f.querySelector(
68-
'button:nth-child(4)'
67+
'button:first-child'
6968
) as HTMLElement
7069
if (!copy_button) {
7170
report_initialization_error({

0 commit comments

Comments
 (0)