Skip to content

Commit dca6abf

Browse files
committed
Fix ChatGPT and Gemini prefill URLs
ChatGPT moved to chatgpt.com; using chat.openai.com worked via 308 but is no longer the canonical entry point. Switch to chatgpt.com directly. Gemini's gemini.google.com/guided-learning?query= does not prefill — Gemini has no native URL prefill. Route through Google's AI Mode (google.com/search?q=...&udm=50), which is Gemini-powered and accepts the query parameter.
1 parent e86d0ca commit dca6abf

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/CopyPageButton.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,15 +386,14 @@ export default function CopyPageButton({
386386
}
387387
};
388388

389-
const openInAI = (baseUrl, queryParam = 'q') => {
389+
const openInAI = (baseUrl, queryParam = 'q', extraParams = {}) => {
390390
try {
391391
const currentUrl = window.location.href;
392-
const prompt = encodeURIComponent(
393-
`Please read and explain this documentation page: ${currentUrl}
392+
const prompt = `Please read and explain this documentation page: ${currentUrl}
394393
395-
Please provide a clear summary and help me understand the key concepts covered in this documentation.`
396-
);
397-
window.open(`${baseUrl}?${queryParam}=${prompt}`, "_blank");
394+
Please provide a clear summary and help me understand the key concepts covered in this documentation.`;
395+
const params = new URLSearchParams({ [queryParam]: prompt, ...extraParams });
396+
window.open(`${baseUrl}?${params.toString()}`, "_blank");
398397
} catch (err) {
399398
// Silently fail
400399
}
@@ -483,7 +482,7 @@ Please provide a clear summary and help me understand the key concepts covered i
483482
/>
484483
</svg>
485484
),
486-
action: () => openInAI("https://chat.openai.com/"),
485+
action: () => openInAI("https://chatgpt.com/"),
487486
},
488487
{
489488
id: "claude",
@@ -521,7 +520,7 @@ Please provide a clear summary and help me understand the key concepts covered i
521520
/>
522521
</svg>
523522
),
524-
action: () => openInAI("https://gemini.google.com/guided-learning", "query"),
523+
action: () => openInAI("https://www.google.com/search", "q", { udm: "50" }),
525524
},
526525
];
527526

0 commit comments

Comments
 (0)