Skip to content

Commit b269e31

Browse files
fix: open in llm dropdown
1 parent 09f5d97 commit b269e31

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

layouts/partials/md-dropdown.html

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -131,31 +131,21 @@
131131
}
132132
}
133133

134-
function openInChatGPT() {
135-
fetch(getCurrentPlaintextUrl())
136-
.then((response) => response.text())
137-
.then((text) => {
138-
const encodedText = encodeURIComponent(text);
139-
const chatGPTUrl = `https://chat.openai.com/?q=${encodedText}`;
140-
window.open(chatGPTUrl, "_blank");
141-
})
142-
.catch((err) => {
143-
console.error("Error opening in ChatGPT:", err);
144-
});
145-
}
146-
147-
function openInClaude() {
148-
fetch(getCurrentPlaintextUrl())
149-
.then((response) => response.text())
150-
.then((text) => {
151-
const encodedText = encodeURIComponent(text);
152-
const claudeUrl = `https://claude.ai/new?q=${encodedText}`;https://claude.ai/new?q=%22hey%22
153-
window.open(claudeUrl, '_blank');
154-
})
155-
.catch((err) => {
156-
console.error("Error opening in Claude:", err);
157-
});
158-
}
134+
function openInChatGPT() {
135+
const markdownUrl = getCurrentPlaintextUrl();
136+
const prompt = `Read ${markdownUrl} so I can ask questions about it.`;
137+
const encodedText = encodeURIComponent(prompt);
138+
const chatGPTUrl = `https://chat.openai.com/?q=${encodedText}`;
139+
window.open(chatGPTUrl, "_blank");
140+
}
141+
142+
function openInClaude() {
143+
const markdownUrl = getCurrentPlaintextUrl();
144+
const prompt = `Read ${markdownUrl} so I can ask questions about it.`;
145+
const encodedText = encodeURIComponent(prompt);
146+
const claudeUrl = `https://claude.ai/new?q=${encodedText}`;
147+
window.open(claudeUrl, '_blank');
148+
}
159149

160150
document.addEventListener("click", function (event) {
161151
const dropdown = document.getElementById("markdownDropdown");

0 commit comments

Comments
 (0)