mirror of
https://github.com/trycua/computer.git
synced 2026-01-06 05:20:02 -06:00
Format codebase with uv run pre-commit run --all-files
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
{
|
||||
"pages": [
|
||||
"introduction",
|
||||
"screenspot-v2",
|
||||
"screenspot-pro",
|
||||
"interactive",
|
||||
"osworld-verified"
|
||||
]
|
||||
}
|
||||
"pages": ["introduction", "screenspot-v2", "screenspot-pro", "interactive", "osworld-verified"]
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
{
|
||||
"title": "Callbacks",
|
||||
"description": "Extending agents with callback hooks and built-in handlers",
|
||||
"pages": [
|
||||
"agent-lifecycle",
|
||||
"trajectories",
|
||||
"logging",
|
||||
"cost-saving",
|
||||
"pii-anonymization"
|
||||
]
|
||||
"title": "Callbacks",
|
||||
"description": "Extending agents with callback hooks and built-in handlers",
|
||||
"pages": ["agent-lifecycle", "trajectories", "logging", "cost-saving", "pii-anonymization"]
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
{
|
||||
"title": "Agent SDK",
|
||||
"description": "Build computer-using agents with the Agent SDK",
|
||||
"pages": [
|
||||
"agent-loops",
|
||||
"supported-agents",
|
||||
"supported-model-providers",
|
||||
"chat-history",
|
||||
"message-format",
|
||||
"customizing-computeragent",
|
||||
"callbacks",
|
||||
"custom-tools",
|
||||
"custom-computer-handlers",
|
||||
"prompt-caching",
|
||||
"usage-tracking",
|
||||
"benchmarks",
|
||||
"migration-guide",
|
||||
"integrations"
|
||||
]
|
||||
"title": "Agent SDK",
|
||||
"description": "Build computer-using agents with the Agent SDK",
|
||||
"pages": [
|
||||
"agent-loops",
|
||||
"supported-agents",
|
||||
"supported-model-providers",
|
||||
"chat-history",
|
||||
"message-format",
|
||||
"customizing-computeragent",
|
||||
"callbacks",
|
||||
"custom-tools",
|
||||
"custom-computer-handlers",
|
||||
"prompt-caching",
|
||||
"usage-tracking",
|
||||
"benchmarks",
|
||||
"migration-guide",
|
||||
"integrations"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
{
|
||||
"title": "Supported Agents",
|
||||
"description": "Models and configurations supported by the Agent SDK",
|
||||
"pages": [
|
||||
"computer-use-agents",
|
||||
"grounding-models",
|
||||
"composed-agents",
|
||||
"human-in-the-loop"
|
||||
]
|
||||
"title": "Supported Agents",
|
||||
"description": "Models and configurations supported by the Agent SDK",
|
||||
"pages": ["computer-use-agents", "grounding-models", "composed-agents", "human-in-the-loop"]
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
{
|
||||
"title": "Computer SDK",
|
||||
"description": "Build computer-using agents with the Computer SDK",
|
||||
"pages": [
|
||||
"computers",
|
||||
"cloud-vm-management",
|
||||
"commands",
|
||||
"computer-ui",
|
||||
"sandboxed-python"
|
||||
]
|
||||
"title": "Computer SDK",
|
||||
"description": "Build computer-using agents with the Computer SDK",
|
||||
"pages": ["computers", "cloud-vm-management", "commands", "computer-ui", "sandboxed-python"]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
"title": "Example Use Cases",
|
||||
"description": "Real-world examples of building with Cua",
|
||||
"pages": [
|
||||
"form-filling"
|
||||
]
|
||||
"title": "Example Use Cases",
|
||||
"description": "Real-world examples of building with Cua",
|
||||
"pages": ["form-filling"]
|
||||
}
|
||||
|
||||
@@ -17,10 +17,12 @@ Lume follows the XDG Base Directory specification for the configuration file:
|
||||
- Configuration is stored in `$XDG_CONFIG_HOME/lume/config.yaml` (defaults to `~/.config/lume/config.yaml`)
|
||||
|
||||
By default, other data is stored in:
|
||||
|
||||
- VM data: `~/.lume`
|
||||
- Cache files: `~/.lume/cache`
|
||||
|
||||
The config file contains settings for:
|
||||
|
||||
- VM storage locations and the default location
|
||||
- Cache directory location
|
||||
- Whether caching is enabled
|
||||
@@ -88,6 +90,7 @@ lume delete <name>
|
||||
### How to Install macOS from an IPSW Image
|
||||
|
||||
#### Create a new macOS VM using the latest supported IPSW image:
|
||||
|
||||
Run the following command to create a new macOS virtual machine using the latest available IPSW image:
|
||||
|
||||
```bash
|
||||
@@ -95,6 +98,7 @@ lume create <name> --os macos --ipsw latest
|
||||
```
|
||||
|
||||
#### Create a new macOS VM using a specific IPSW image:
|
||||
|
||||
To create a macOS virtual machine from an older or specific IPSW file, first download the desired IPSW (UniversalMac) from a trusted source.
|
||||
|
||||
Then, use the downloaded IPSW path:
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
{
|
||||
"pages": [
|
||||
"installation",
|
||||
"prebuilt-images",
|
||||
"cli-reference",
|
||||
"http-api",
|
||||
"faq"
|
||||
]
|
||||
"pages": ["installation", "prebuilt-images", "cli-reference", "http-api", "faq"]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
{
|
||||
"pages": [
|
||||
"installation",
|
||||
"docker",
|
||||
"docker-compose",
|
||||
"building-lumier"
|
||||
]
|
||||
"pages": ["installation", "docker", "docker-compose", "building-lumier"]
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"pages": [
|
||||
"installation",
|
||||
"configuration",
|
||||
"usage",
|
||||
"tools",
|
||||
"client-integrations",
|
||||
"llm-integrations"
|
||||
]
|
||||
}
|
||||
"pages": [
|
||||
"installation",
|
||||
"configuration",
|
||||
"usage",
|
||||
"tools",
|
||||
"client-integrations",
|
||||
"llm-integrations"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"title": "Home",
|
||||
"description": "Documentation Home",
|
||||
"root": true,
|
||||
"defaultOpen": true,
|
||||
"pages": [
|
||||
"index",
|
||||
"quickstart-devs",
|
||||
"quickstart-cli",
|
||||
"telemetry",
|
||||
"example-usecases",
|
||||
"---[BookCopy]Computer Playbook---",
|
||||
"...computer-sdk",
|
||||
"---[BookCopy]Agent Playbook---",
|
||||
"...agent-sdk",
|
||||
"---[CodeXml]API Reference---",
|
||||
"...libraries"
|
||||
]
|
||||
}
|
||||
"title": "Home",
|
||||
"description": "Documentation Home",
|
||||
"root": true,
|
||||
"defaultOpen": true,
|
||||
"pages": [
|
||||
"index",
|
||||
"quickstart-devs",
|
||||
"quickstart-cli",
|
||||
"telemetry",
|
||||
"example-usecases",
|
||||
"---[BookCopy]Computer Playbook---",
|
||||
"...computer-sdk",
|
||||
"---[BookCopy]Agent Playbook---",
|
||||
"...agent-sdk",
|
||||
"---[CodeXml]API Reference---",
|
||||
"...libraries"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -43,4 +43,4 @@
|
||||
"sharp"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
defineConfig,
|
||||
defineDocs,
|
||||
frontmatterSchema,
|
||||
metaSchema,
|
||||
} from 'fumadocs-mdx/config';
|
||||
import { defineConfig, defineDocs, frontmatterSchema, metaSchema } from 'fumadocs-mdx/config';
|
||||
import { z } from 'zod';
|
||||
|
||||
// You can customise Zod schemas for frontmatter and `meta.json` here
|
||||
|
||||
@@ -1,18 +1,9 @@
|
||||
import { getApiVersions, source } from '@/lib/source';
|
||||
import { getMDXComponents } from '@/mdx-components';
|
||||
import { buttonVariants } from 'fumadocs-ui/components/ui/button';
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from 'fumadocs-ui/components/ui/popover';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from 'fumadocs-ui/components/ui/popover';
|
||||
import { createRelativeLink } from 'fumadocs-ui/mdx';
|
||||
import {
|
||||
DocsBody,
|
||||
DocsDescription,
|
||||
DocsPage,
|
||||
DocsTitle,
|
||||
} from 'fumadocs-ui/page';
|
||||
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/page';
|
||||
import { cn } from 'fumadocs-ui/utils/cn';
|
||||
import { ChevronDown, CodeXml, ExternalLink } from 'lucide-react';
|
||||
import type { Metadata } from 'next';
|
||||
@@ -20,9 +11,7 @@ import Link from 'next/link';
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
import { PageFeedback } from '@/components/page-feedback';
|
||||
|
||||
export default async function Page(props: {
|
||||
params: Promise<{ slug?: string[] }>;
|
||||
}) {
|
||||
export default async function Page(props: { params: Promise<{ slug?: string[] }> }) {
|
||||
const params = await props.params;
|
||||
const slug = params.slug || [];
|
||||
const page = source.getPage(slug);
|
||||
@@ -66,7 +55,8 @@ export default async function Page(props: {
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="currentColor"
|
||||
className="h-5"
|
||||
viewBox="0 0 448 512">
|
||||
viewBox="0 0 448 512"
|
||||
>
|
||||
<title>Windows</title>
|
||||
<path d="M0 93.7l183.6-25.3v177.4H0V93.7zm0 324.6l183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z" />
|
||||
</svg>
|
||||
@@ -76,7 +66,8 @@ export default async function Page(props: {
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="currentColor"
|
||||
className="h-5"
|
||||
viewBox="0 0 384 512">
|
||||
viewBox="0 0 384 512"
|
||||
>
|
||||
<title>macOS</title>
|
||||
<path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z" />
|
||||
</svg>
|
||||
@@ -86,7 +77,8 @@ export default async function Page(props: {
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="currentColor"
|
||||
className="h-5"
|
||||
viewBox="0 0 448 512">
|
||||
viewBox="0 0 448 512"
|
||||
>
|
||||
<title>Linux</title>
|
||||
<path d="M220.8 123.3c1 .5 1.8 1.7 3 1.7 1.1 0 2.8-.4 2.9-1.5 .2-1.4-1.9-2.3-3.2-2.9-1.7-.7-3.9-1-5.5-.1-.4 .2-.8 .7-.6 1.1 .3 1.3 2.3 1.1 3.4 1.7zm-21.9 1.7c1.2 0 2-1.2 3-1.7 1.1-.6 3.1-.4 3.5-1.6 .2-.4-.2-.9-.6-1.1-1.6-.9-3.8-.6-5.5 .1-1.3 .6-3.4 1.5-3.2 2.9 .1 1 1.8 1.5 2.8 1.4zM420 403.8c-3.6-4-5.3-11.6-7.2-19.7-1.8-8.1-3.9-16.8-10.5-22.4-1.3-1.1-2.6-2.1-4-2.9-1.3-.8-2.7-1.5-4.1-2 9.2-27.3 5.6-54.5-3.7-79.1-11.4-30.1-31.3-56.4-46.5-74.4-17.1-21.5-33.7-41.9-33.4-72C311.1 85.4 315.7 .1 234.8 0 132.4-.2 158 103.4 156.9 135.2c-1.7 23.4-6.4 41.8-22.5 64.7-18.9 22.5-45.5 58.8-58.1 96.7-6 17.9-8.8 36.1-6.2 53.3-6.5 5.8-11.4 14.7-16.6 20.2-4.2 4.3-10.3 5.9-17 8.3s-14 6-18.5 14.5c-2.1 3.9-2.8 8.1-2.8 12.4 0 3.9 .6 7.9 1.2 11.8 1.2 8.1 2.5 15.7 .8 20.8-5.2 14.4-5.9 24.4-2.2 31.7 3.8 7.3 11.4 10.5 20.1 12.3 17.3 3.6 40.8 2.7 59.3 12.5 19.8 10.4 39.9 14.1 55.9 10.4 11.6-2.6 21.1-9.6 25.9-20.2 12.5-.1 26.3-5.4 48.3-6.6 14.9-1.2 33.6 5.3 55.1 4.1 .6 2.3 1.4 4.6 2.5 6.7v.1c8.3 16.7 23.8 24.3 40.3 23 16.6-1.3 34.1-11 48.3-27.9 13.6-16.4 36-23.2 50.9-32.2 7.4-4.5 13.4-10.1 13.9-18.3 .4-8.2-4.4-17.3-15.5-29.7zM223.7 87.3c9.8-22.2 34.2-21.8 44-.4 6.5 14.2 3.6 30.9-4.3 40.4-1.6-.8-5.9-2.6-12.6-4.9 1.1-1.2 3.1-2.7 3.9-4.6 4.8-11.8-.2-27-9.1-27.3-7.3-.5-13.9 10.8-11.8 23-4.1-2-9.4-3.5-13-4.4-1-6.9-.3-14.6 2.9-21.8zM183 75.8c10.1 0 20.8 14.2 19.1 33.5-3.5 1-7.1 2.5-10.2 4.6 1.2-8.9-3.3-20.1-9.6-19.6-8.4 .7-9.8 21.2-1.8 28.1 1 .8 1.9-.2-5.9 5.5-15.6-14.6-10.5-52.1 8.4-52.1zm-13.6 60.7c6.2-4.6 13.6-10 14.1-10.5 4.7-4.4 13.5-14.2 27.9-14.2 7.1 0 15.6 2.3 25.9 8.9 6.3 4.1 11.3 4.4 22.6 9.3 8.4 3.5 13.7 9.7 10.5 18.2-2.6 7.1-11 14.4-22.7 18.1-11.1 3.6-19.8 16-38.2 14.9-3.9-.2-7-1-9.6-2.1-8-3.5-12.2-10.4-20-15-8.6-4.8-13.2-10.4-14.7-15.3-1.4-4.9 0-9 4.2-12.3zm3.3 334c-2.7 35.1-43.9 34.4-75.3 18-29.9-15.8-68.6-6.5-76.5-21.9-2.4-4.7-2.4-12.7 2.6-26.4v-.2c2.4-7.6 .6-16-.6-23.9-1.2-7.8-1.8-15 .9-20 3.5-6.7 8.5-9.1 14.8-11.3 10.3-3.7 11.8-3.4 19.6-9.9 5.5-5.7 9.5-12.9 14.3-18 5.1-5.5 10-8.1 17.7-6.9 8.1 1.2 15.1 6.8 21.9 16l19.6 35.6c9.5 19.9 43.1 48.4 41 68.9zm-1.4-25.9c-4.1-6.6-9.6-13.6-14.4-19.6 7.1 0 14.2-2.2 16.7-8.9 2.3-6.2 0-14.9-7.4-24.9-13.5-18.2-38.3-32.5-38.3-32.5-13.5-8.4-21.1-18.7-24.6-29.9s-3-23.3-.3-35.2c5.2-22.9 18.6-45.2 27.2-59.2 2.3-1.7 .8 3.2-8.7 20.8-8.5 16.1-24.4 53.3-2.6 82.4 .6-20.7 5.5-41.8 13.8-61.5 12-27.4 37.3-74.9 39.3-112.7 1.1 .8 4.6 3.2 6.2 4.1 4.6 2.7 8.1 6.7 12.6 10.3 12.4 10 28.5 9.2 42.4 1.2 6.2-3.5 11.2-7.5 15.9-9 9.9-3.1 17.8-8.6 22.3-15 7.7 30.4 25.7 74.3 37.2 95.7 6.1 11.4 18.3 35.5 23.6 64.6 3.3-.1 7 .4 10.9 1.4 13.8-35.7-11.7-74.2-23.3-84.9-4.7-4.6-4.9-6.6-2.6-6.5 12.6 11.2 29.2 33.7 35.2 59 2.8 11.6 3.3 23.7 .4 35.7 16.4 6.8 35.9 17.9 30.7 34.8-2.2-.1-3.2 0-4.2 0 3.2-10.1-3.9-17.6-22.8-26.1-19.6-8.6-36-8.6-38.3 12.5-12.1 4.2-18.3 14.7-21.4 27.3-2.8 11.2-3.6 24.7-4.4 39.9-.5 7.7-3.6 18-6.8 29-32.1 22.9-76.7 32.9-114.3 7.2zm257.4-11.5c-.9 16.8-41.2 19.9-63.2 46.5-13.2 15.7-29.4 24.4-43.6 25.5s-26.5-4.8-33.7-19.3c-4.7-11.1-2.4-23.1 1.1-36.3 3.7-14.2 9.2-28.8 9.9-40.6 .8-15.2 1.7-28.5 4.2-38.7 2.6-10.3 6.6-17.2 13.7-21.1 .3-.2 .7-.3 1-.5 .8 13.2 7.3 26.6 18.8 29.5 12.6 3.3 30.7-7.5 38.4-16.3 9-.3 15.7-.9 22.6 5.1 9.9 8.5 7.1 30.3 17.1 41.6 10.6 11.6 14 19.5 13.7 24.6zM173.3 148.7c2 1.9 4.7 4.5 8 7.1 6.6 5.2 15.8 10.6 27.3 10.6 11.6 0 22.5-5.9 31.8-10.8 4.9-2.6 10.9-7 14.8-10.4s5.9-6.3 3.1-6.6-2.6 2.6-6 5.1c-4.4 3.2-9.7 7.4-13.9 9.8-7.4 4.2-19.5 10.2-29.9 10.2s-18.7-4.8-24.9-9.7c-3.1-2.5-5.7-5-7.7-6.9-1.5-1.4-1.9-4.6-4.3-4.9-1.4-.1-1.8 3.7 1.7 6.5z" />
|
||||
</svg>
|
||||
@@ -96,10 +88,7 @@ export default async function Page(props: {
|
||||
|
||||
<div className="flex flex-row gap-2 items-left">
|
||||
{pypi && (
|
||||
<a
|
||||
target="_blank"
|
||||
href={`https://pypi.org/project/${pypi}/`}
|
||||
rel="noreferrer">
|
||||
<a target="_blank" href={`https://pypi.org/project/${pypi}/`} rel="noreferrer">
|
||||
<img
|
||||
src={`https://img.shields.io/pypi/v/${pypi}?color=blue`}
|
||||
className="h-5"
|
||||
@@ -108,10 +97,7 @@ export default async function Page(props: {
|
||||
</a>
|
||||
)}
|
||||
{npm && (
|
||||
<a
|
||||
target="_blank"
|
||||
href={`https://www.npmjs.com/package/${npm}`}
|
||||
rel="noreferrer">
|
||||
<a target="_blank" href={`https://www.npmjs.com/package/${npm}`} rel="noreferrer">
|
||||
<img
|
||||
src={`https://img.shields.io/npm/v/${npm}?color=bf4c4b`}
|
||||
className="h-5"
|
||||
@@ -138,7 +124,8 @@ export default async function Page(props: {
|
||||
target="_blank"
|
||||
className="inline-flex gap-2 w-fit items-center justify-center rounded-md text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none hover:bg-fd-accent hover:text-fd-accent-foreground p-1.5 [&_svg]:size-5 text-fd-muted-foreground md:[&_svg]:size-4.5"
|
||||
aria-label="Source"
|
||||
data-active="false">
|
||||
data-active="false"
|
||||
>
|
||||
<svg role="img" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"></path>
|
||||
</svg>
|
||||
@@ -162,12 +149,13 @@ export default async function Page(props: {
|
||||
href={link}
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
className="inline-flex gap-2 w-full items-center rounded-md p-2 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground">
|
||||
className="inline-flex gap-2 w-full items-center rounded-md p-2 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground"
|
||||
>
|
||||
{link.includes('python')
|
||||
? 'Python'
|
||||
: link.includes('typescript')
|
||||
? 'TypeScript'
|
||||
: `Source ${index + 1}`}
|
||||
? 'TypeScript'
|
||||
: `Source ${index + 1}`}
|
||||
<ExternalLink className="w-4 h-4 ml-auto" />
|
||||
</a>
|
||||
))}
|
||||
@@ -190,10 +178,7 @@ export default async function Page(props: {
|
||||
};
|
||||
|
||||
return (
|
||||
<DocsPage
|
||||
toc={page.data.toc}
|
||||
tableOfContent={{ header: tocHeader() }}
|
||||
full={page.data.full}>
|
||||
<DocsPage toc={page.data.toc} tableOfContent={{ header: tocHeader() }} full={page.data.full}>
|
||||
<div className="flex flex-row w-full items-start">
|
||||
<div className="flex-1">
|
||||
<div className="flex flex-row w-full">
|
||||
@@ -209,15 +194,14 @@ export default async function Page(props: {
|
||||
size: 'sm',
|
||||
className: 'gap-2',
|
||||
})
|
||||
)}>
|
||||
)}
|
||||
>
|
||||
{(() => {
|
||||
// Find the current version label
|
||||
let currentLabel = 'Current';
|
||||
if (apiVersionSlug.length > 0) {
|
||||
const found = versionItems.find(
|
||||
(item) =>
|
||||
item.label !== 'Current' &&
|
||||
apiVersionSlug[0] === item.label
|
||||
(item) => item.label !== 'Current' && apiVersionSlug[0] === item.label
|
||||
);
|
||||
if (found) currentLabel = found.label;
|
||||
}
|
||||
@@ -238,10 +222,8 @@ export default async function Page(props: {
|
||||
: `/api/${apiSection}/${item.label}`;
|
||||
// Highlight current version
|
||||
const isCurrent =
|
||||
(item.label === 'Current' &&
|
||||
apiVersionSlug.length === 0) ||
|
||||
(item.label !== 'Current' &&
|
||||
apiVersionSlug[0] === item.label);
|
||||
(item.label === 'Current' && apiVersionSlug.length === 0) ||
|
||||
(item.label !== 'Current' && apiVersionSlug[0] === item.label);
|
||||
return (
|
||||
<Link
|
||||
key={item.label}
|
||||
@@ -249,7 +231,8 @@ export default async function Page(props: {
|
||||
className={cn(
|
||||
'px-3 py-1 rounded hover:bg-fd-muted',
|
||||
isCurrent && 'font-bold bg-fd-muted'
|
||||
)}>
|
||||
)}
|
||||
>
|
||||
API version: {item.label}
|
||||
</Link>
|
||||
);
|
||||
@@ -259,9 +242,7 @@ export default async function Page(props: {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<DocsDescription className="text-md mt-1">
|
||||
{page.data.description}
|
||||
</DocsDescription>
|
||||
<DocsDescription className="text-md mt-1">{page.data.description}</DocsDescription>
|
||||
</div>
|
||||
</div>
|
||||
<DocsBody>
|
||||
@@ -290,8 +271,7 @@ export async function generateMetadata(props: {
|
||||
|
||||
let title = `${page.data.title} | Cua Docs`;
|
||||
if (page.url.includes('api')) title = `${page.data.title} | Cua API Docs`;
|
||||
if (page.url.includes('guide'))
|
||||
title = ` Guide: ${page.data.title} | Cua Docs`;
|
||||
if (page.url.includes('guide')) title = ` Guide: ${page.data.title} | Cua Docs`;
|
||||
|
||||
return {
|
||||
title,
|
||||
|
||||
@@ -24,9 +24,7 @@ export default function Layout({ children }: { children: ReactNode }) {
|
||||
<PostHogPageView />
|
||||
</Suspense>
|
||||
<AnalyticsTracker />
|
||||
<RootProvider search={{ options: { api: '/docs/api/search' } }}>
|
||||
{children}
|
||||
</RootProvider>
|
||||
<RootProvider search={{ options: { api: '/docs/api/search' } }}>{children}</RootProvider>
|
||||
<Footer />
|
||||
<CookieConsent />
|
||||
</PHProvider>
|
||||
|
||||
@@ -5,10 +5,7 @@ import { notFound } from 'next/navigation';
|
||||
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET(
|
||||
_req: NextRequest,
|
||||
{ params }: { params: Promise<{ slug?: string[] }> }
|
||||
) {
|
||||
export async function GET(_req: NextRequest, { params }: { params: Promise<{ slug?: string[] }> }) {
|
||||
const { slug } = await params;
|
||||
const page = source.getPage(slug);
|
||||
if (!page) notFound();
|
||||
|
||||
@@ -55,14 +55,17 @@ export function EditableCodeBlock({
|
||||
const [values, setValues] = useState<Record<string, string>>(defaultValues);
|
||||
|
||||
const updateValue = (key: string, value: string) => {
|
||||
setValues(prev => ({ ...prev, [key]: value }));
|
||||
setValues((prev) => ({ ...prev, [key]: value }));
|
||||
};
|
||||
|
||||
return (
|
||||
<EditableCodeContext.Provider value={{ values, updateValue }}>
|
||||
<Base.CodeBlock title={title} className={cn('my-4', className)}>
|
||||
<Base.Pre className={cn(`language-${lang}`, "px-3")}>
|
||||
<code className={cn(`language-${lang}`)} style={{ display: 'block', whiteSpace: 'pre-wrap' }}>
|
||||
<Base.Pre className={cn(`language-${lang}`, 'px-3')}>
|
||||
<code
|
||||
className={cn(`language-${lang}`)}
|
||||
style={{ display: 'block', whiteSpace: 'pre-wrap' }}
|
||||
>
|
||||
{children}
|
||||
</code>
|
||||
</Base.Pre>
|
||||
@@ -219,9 +222,7 @@ export function EditableValue({
|
||||
value={value}
|
||||
onChange={(e) => updateValue(placeholder, e.target.value)}
|
||||
placeholder={placeholder}
|
||||
className={cn(
|
||||
type === 'password' && value && 'text-security-disc'
|
||||
)}
|
||||
className={cn(type === 'password' && value && 'text-security-disc')}
|
||||
style={{
|
||||
display: 'inline',
|
||||
width: inputWidth,
|
||||
|
||||
@@ -34,7 +34,7 @@ interface IOUProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* A React component that visualizes and calculates the Intersection over Union (IOU)
|
||||
* A React component that visualizes and calculates the Intersection over Union (IOU)
|
||||
* of two rectangles on a canvas
|
||||
* @param props - The component props
|
||||
* @returns The rendered IOU visualization component
|
||||
@@ -130,12 +130,7 @@ export default function IOU({ title, description, rect1, rect2 }: IOUProps) {
|
||||
<h3 className="text-sm font-semibold ">{title}</h3>
|
||||
<div className="flex items-start gap-6">
|
||||
<div>
|
||||
<canvas
|
||||
ref={canvasRef}
|
||||
width={200}
|
||||
height={150}
|
||||
className="border bg-white rounded-md"
|
||||
/>
|
||||
<canvas ref={canvasRef} width={200} height={150} className="border bg-white rounded-md" />
|
||||
<div className="mt-2 text-sm">
|
||||
<div className="font-mono mb-2">IOU = {actualIOU.toFixed(3)}</div>
|
||||
<span className="">{description}</span>
|
||||
|
||||
@@ -28,10 +28,7 @@ export function Mermaid({ chart }: { chart: string }) {
|
||||
theme: resolvedTheme === 'dark' ? 'dark' : 'default',
|
||||
});
|
||||
|
||||
const { svg, bindFunctions } = await mermaid.render(
|
||||
id,
|
||||
chart.replaceAll('\\n', '\n'),
|
||||
);
|
||||
const { svg, bindFunctions } = await mermaid.render(id, chart.replaceAll('\\n', '\n'));
|
||||
|
||||
bindFunctions?.(container);
|
||||
setSvg(svg);
|
||||
@@ -44,4 +41,4 @@ export function Mermaid({ chart }: { chart: string }) {
|
||||
}, [chart, id, resolvedTheme]);
|
||||
|
||||
return <div ref={containerRef} dangerouslySetInnerHTML={{ __html: svg }} />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export function PageFeedback() {
|
||||
<p className="text-sm text-fd-muted-foreground text-left">
|
||||
{feedback === 'helpful'
|
||||
? 'Thanks for your feedback!'
|
||||
: 'Thanks for your feedback. We\'ll work on improving this page.'}
|
||||
: "Thanks for your feedback. We'll work on improving this page."}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -34,9 +34,7 @@ export async function getApiVersions(
|
||||
...versions.filter((v) => v.label === 'Current'),
|
||||
...versions
|
||||
.filter((v) => v.label !== 'Current')
|
||||
.sort((a, b) =>
|
||||
b.label.localeCompare(a.label, undefined, { numeric: true })
|
||||
),
|
||||
.sort((a, b) => b.label.localeCompare(a.label, undefined, { numeric: true })),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"target": "ESNext",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
@@ -20,12 +16,8 @@
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"paths": {
|
||||
"@/.source": [
|
||||
"./.source/index.ts"
|
||||
],
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
]
|
||||
"@/.source": ["./.source/index.ts"],
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
@@ -33,13 +25,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user