import { useState } from 'react'; import { toast } from 'react-toastify'; import Cookies from 'js-cookie'; import { anthropicNumFreeUsesCookieName, anthropicApiKeyCookieName, MaxFreeUses } from '~/utils/freeUses'; export default function ConnectionsTab() { const [apiKey, setApiKey] = useState(Cookies.get(anthropicApiKeyCookieName) || ''); const numFreeUses = +(Cookies.get(anthropicNumFreeUsesCookieName) || 0); const handleSaveAPIKey = async (key: string) => { if (!key || !key.startsWith('sk-ant-')) { toast.error('Please provide a valid Anthropic API key'); return; } Cookies.set('anthropicApiKey', key); setApiKey(key); }; return (