Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions apify-docs-theme/src/theme/LLMButtons/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import clsx from 'clsx';
import React, { useCallback, useState } from 'react';

import {
AnthropicIcon,
ChatGptIcon,
CheckIcon,
ChevronDownIcon,
Expand Down Expand Up @@ -37,6 +38,13 @@ const DROPDOWN_OPTIONS = [
Icon: ChatGptIcon,
value: 'openInChatGPT',
},
{
label: 'Open in Claude',
description: 'Ask questions about this page',
showExternalIcon: true,
Icon: AnthropicIcon,
value: 'openInClaude',
},
{
label: 'Open in Perplexity',
description: 'Ask questions about this page',
Expand Down Expand Up @@ -70,6 +78,27 @@ const onOpenInChatGPTClick = () => {
}
};

const onOpenInClaudeClick = () => {
if (window.analytics) {
window.analytics.track('Clicked', {
app: 'docs',
button_text: 'Open in Claude',
element: 'llm-buttons.openInClaude',
});
}

const prompt = getPrompt(window.location.href);

try {
window.open(
`https://claude.ai/new?q=${encodeURIComponent(prompt)}`,
'_blank',
);
} catch (error) {
console.error('Error opening Claude:', error);
}
};

const onOpenInPerplexityClick = () => {
if (window.analytics) {
window.analytics.track('Clicked', {
Expand Down Expand Up @@ -227,6 +256,9 @@ export default function LLMButtons({ isApiReferencePage = false }) {
case 'openInChatGPT':
onOpenInChatGPTClick();
break;
case 'openInClaude':
onOpenInClaudeClick();
break;
case 'openInPerplexity':
onOpenInPerplexityClick();
break;
Expand Down