'use client'
import { Feedback } from '~/components/Feedback'
import { useSendTelemetryEvent } from '~/lib/telemetry'
import { askAiUrls, isFeatureEnabled, useCopyMarkdownFromUrl } from 'common'
import { Chatgpt, Claude } from 'icons'
import { Check, Copy, Sparkles } from 'lucide-react'
import Link from 'next/link'
import { usePathname } from 'next/navigation'
import { cn } from 'ui'
import { ExpandableVideo } from 'ui-patterns/ExpandableVideo'
import { Toc, TOCItems, TOCScrollArea } from 'ui-patterns/Toc'
import { useTocAnchors } from '../features/docs/GuidesMdx.state'
interface TOCHeader {
id?: string
text: string
link: string
level: number
}
function AiTools({ className }: { className?: string }) {
const path = usePathname()
const sendTelemetryEvent = useSendTelemetryEvent()
const { copied, copyMarkdown } = useCopyMarkdownFromUrl()
const urls = askAiUrls(`https://supabase.com/docs${path}`)
function handleAgentSetupClick() {
sendTelemetryEvent({ action: 'agent_setup_clicked' })
}
async function handleCopy() {
const ok = await copyMarkdown(`/docs${path}.md`, {
fallback: () => document.getElementById('sb-docs-guide-main-article')?.innerHTML ?? '',
})
if (ok) {
sendTelemetryEvent({ action: 'copy_as_markdown_clicked', properties: { pageType: 'guide' } })
}
}
return (
AI Tools