Skip to content

Commit 50dec07

Browse files
committed
Adjust ChatGPT integration to correctly position the "Apply Response" button and remove the page readiness timeout
1 parent 575756a commit 50dec07

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import { show_response_ready_notification } from '../utils/show-response-ready-n
1515

1616
export const chatgpt: Chatbot = {
1717
wait_until_ready: async () => {
18-
const max_wait_time = 2000
19-
const start_time = Date.now()
20-
2118
await new Promise((resolve) => {
2219
const check_for_element = () => {
2320
if (
@@ -26,8 +23,6 @@ export const chatgpt: Chatbot = {
2623
)
2724
) {
2825
resolve(null)
29-
} else if (Date.now() - start_time >= max_wait_time) {
30-
resolve(null)
3126
} else {
3227
setTimeout(check_for_element, 100)
3328
}
@@ -105,7 +100,7 @@ export const chatgpt: Chatbot = {
105100

106101
params.footer.insertBefore(
107102
apply_response_button,
108-
params.footer.children[params.footer.children.length - 1]
103+
params.footer.children[params.footer.children.length]
109104
)
110105

111106
apply_response_button.focus()
@@ -123,7 +118,7 @@ export const chatgpt: Chatbot = {
123118
show_response_ready_notification({ chatbot_name: 'ChatGPT' })
124119

125120
const all_footers = document.querySelectorAll(
126-
'.agent-turn > div:nth-of-type(2) > div > div'
121+
'.agent-turn > div:nth-of-type(2) > div'
127122
)
128123
all_footers.forEach((footer) => {
129124
add_buttons({

packages/browser/src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Code Web Chat Connector",
55
"short_name": "CWC",
66
"description": "Initialize 15+ chatbots and manage websites for context.",
7-
"version": "1.22.0",
7+
"version": "1.23.0",
88
"homepage_url": "https://github.com/robertpiosik/CodeWebChat",
99
"icons": {
1010
"16": "icons/icon-16.png",

0 commit comments

Comments
 (0)