Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Automatically expand navigation subgroups based on URL
Vasek Mlejnsky085a6cbf4f4b
diff --git a/apps/web/src/app/(docs)/docs/quickstart/connect-llms/page.mdx b/apps/web/src/app/(docs)/docs/quickstart/connect-llms/page.mdxnew file mode 100644index 000000000..6024297a5--- /dev/null+++ b/apps/web/src/app/(docs)/docs/quickstart/connect-llms/page.mdx@@ -0,0 +1 @@+Connect\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/quickstart/page.mdx b/apps/web/src/app/(docs)/docs/quickstart/page.mdxindex b9b34ff7c..64e2a4e81 100644--- a/apps/web/src/app/(docs)/docs/quickstart/page.mdx+++ b/apps/web/src/app/(docs)/docs/quickstart/page.mdx@@ -30,6 +30,7 @@ pip install e2b python-dotenv</CodeGroup>## 4. Write code for starting Sandbox+We'll write the minimal code for starting Sandbox, executing Python inside it and listing all files inside the root directory.<CodeGroup>```ts {{ language: 'js', description: 'index.ts' }}import 'dotenv/config'@@ -38,20 +39,27 @@ import { Sandbox } from 'e2b'const sbx = await Sandbox.create() // By default the sandbox is alive for 5 minutesconst execution = await sbx.runCode('print("hello world")') // Execute Python inside the sandboxconsole.log(execution.logs)++const files = await sbx.files.list('/')+console.log(files)``````python {{ language: 'python', description: 'main.py' }}from dotenv import load_dotenvload_dotenv()-from e2b import Sandbox+sbx = Sandbox() # By default the sandbox is alive for 5 minutesexecution = sbx.run_code("print('hello world')") # Execute Python inside the sandboxprint(execution.logs)++files = sbx.files.list("/")+print(files)```</CodeGroup>## 5. Start your first E2B Sandbox+Run the code with the following command:<CodeGroup isTerminalCommand>```bash {{ language: 'js' }}npx tsx ./index.tsdiff --git a/apps/web/src/components/Navigation/NavigationSubgroup.tsx b/apps/web/src/components/Navigation/NavigationSubgroup.tsxindex f0951c2b8..64a65f7ee 100644--- a/apps/web/src/components/Navigation/NavigationSubgroup.tsx+++ b/apps/web/src/components/Navigation/NavigationSubgroup.tsx@@ -1,10 +1,23 @@-import { useState } from 'react'+import { useEffect, useState } from 'react'+import { usePathname } from 'next/navigation'+import clsx from 'clsx'+import { ChevronDown, ChevronRight } from 'lucide-react'+import { NavSubgroup } from './routes'import { NavigationLink } from './NavigationLink'-import { ChevronDown, ChevronRight } from 'lucide-react'export function NavigationSubgroup({ subgroup }: { subgroup: NavSubgroup }) {const [isExpanded, setIsExpanded] = useState(false)+ const pathname = usePathname()++ const isActive = subgroup.links.some(link => link.href === pathname)++ // Automatically expand the subgroup if it's active+ useEffect(() => {+ if (isActive) {+ setIsExpanded(true)+ }+ }, [isActive])const toggleExpand = () => {setIsExpanded(!isExpanded)@@ -14,11 +27,16 @@ export function NavigationSubgroup({ subgroup }: { subgroup: NavSubgroup }) {<div><buttononClick={toggleExpand}- className="group flex items-center justify-between w-full text-left px-2 py-1 rounded-md hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors"+ className={clsx(+ 'group flex items-center justify-between w-full text-left px-2 py-1 rounded-md transition-colors',+ isActive+ ? 'text-white bg-zinc-800'+ : 'hover:text-white text-zinc-400 bg-transparent'+ )}><div className="flex items-center justify-start gap-1">{subgroup.icon}- <h3 className="text-sm font-medium text-zinc-400 group-hover:text-white">{subgroup.title}</h3>+ <h3 className="text-sm font-medium group-hover:text-white">{subgroup.title}</h3></div>{isExpanded ? (<ChevronDown className="w-4 h-4 ml-2 text-zinc-400 group-hover:text-white" />diff --git a/apps/web/src/components/Navigation/routes.tsx b/apps/web/src/components/Navigation/routes.tsxindex 72d716969..f48838190 100644--- a/apps/web/src/components/Navigation/routes.tsx+++ b/apps/web/src/components/Navigation/routes.tsx@@ -139,18 +139,18 @@ export const routes: NavGroup[] = [// ]// },{- title: 'Code Interpreting',+ title: '* Code Interpreting',items: [{- title: 'Analyze data with AI',+ title: '* Analyze data with AI',href: '/docs/code-interpreting/overview',},{- title: 'Create charts & visualizations',+ title: '* Create charts & visualizations',href: '/docs/code-interpreting/overview',},{- title: 'Connect your data',+ title: '* Connect your data',href: '/docs/code-interpreting/overview',},]@@ -169,51 +169,51 @@ export const routes: NavGroup[] = [// ]// },{- title: 'AI Code Execution',+ title: '* AI Code Execution',items: [{- title: 'Python',+ title: '* Python',href: '/docs/code-execution/python',icon: <Image src={logoPython} alt="Python" width={20} height={20} />,},{- title: 'JavaScript',+ title: '* JavaScript',href: '/docs/code-execution/python',icon: <Image src={logoNode} alt="JavaScript" width={20} height={20} />,},{- title: 'TypeScript',+ title: '* TypeScript',href: '/docs/code-execution/python',},{- title: 'Custom language',+ title: '* Custom language',href: '/docs/code-execution/python',},{- title: 'Web frameworks',+ title: '* Web frameworks',links: [{- title: 'Next.js',+ title: '* Next.js',href: '/docs/code-execution/python',},{- title: 'React',+ title: '* React',href: '/docs/code-execution/python',},{- title: 'Svelte',+ title: '* Svelte',href: '/docs/code-execution/python',},{- title: 'Vue.js',+ title: '* Vue.js',href: '/docs/code-execution/python',},{- title: 'Streamlit',+ title: '* Streamlit',href: '/docs/code-execution/python',},{- title: 'Gradio',+ title: '* Gradio',href: '/docs/code-execution/python',},],@@ -221,37 +221,37 @@ export const routes: NavGroup[] = [],},{- title: 'Sandbox',+ title: '* Sandbox',items: [{- title: 'Lifecycle',+ title: '* Lifecycle',href: '/docs/sandbox/lifecycle',},{- title: 'Metadata',+ title: '* Metadata',href: '/docs/sandbox/filesystem',},{- title: 'Environment variables',+ title: '* Environment variables',href: '/docs/sandbox/environment-variables',},{- title: 'Persistence',+ title: '* Persistence',href: '/docs/sandbox/persistence',},{- title: 'Customization',+ title: '* Customization',links: [{- title: 'Overview',+ title: '* Overview',href: '/docs/sandbox/custom',},{- title: 'CPU & RAM',+ title: '* CPU & RAM',href: '/docs/sandbox/custom/compute',},{- title: 'Preinstall packages (TODO: Better title for custom sandbox templates)',+ title: '* Preinstall packages (TODO: Better title for custom sandbox templates)',href: '/docs/sandbox/custom/sandbox-template',},]@@ -259,60 +259,60 @@ export const routes: NavGroup[] = [],},{- title: 'Filesystem',+ title: '* Filesystem',items: [{- title: 'Overview',+ title: '* Overview',href: '/docs/filesystem/overview',},{- title: 'Read & write',+ title: '* Read & write',href: '/docs/filesystem/read-write',},{- title: 'Watch directory for changes',+ title: '* Watch directory for changes',href: '/docs/filesystem/watch',},{- title: 'Upload data',+ title: '* Upload data',href: '/docs/filesystem/upload',},{- title: 'Download data',+ title: '* Download data',href: '/docs/filesystem/download',},]},{- title: 'Commands',+ title: '* Commands',items: [{- title: 'Overview',+ title: '* Overview',href: '/docs/process/overview',},{- title: 'Run commands',+ title: '* Run commands',href: '/docs/process/overview',},{- title: 'Run commands in background',+ title: '* Run commands in background',href: '/docs/process/overview',},]},{- title: 'CLI',+ title: '* CLI',items: [{- title: 'Installation',+ title: '* Installation',href: '/docs/cli/install',},{- title: 'List running sandboxes',+ title: '* List running sandboxes',href: '/docs/cli/list',},{- title: 'Shutdown all running sandboxes',+ title: '* Shutdown all running sandboxes',href: '/docs/cli/kill-all',},]